Opened 6 years ago

Closed 6 years ago

#56993 closed defect (fixed)

Cannot import qtgui from gnuradio

Reported by: angervision Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 2.5.3
Keywords: Cc: eborisch (Eric A. Borisch)
Port: gnuradio

Description

Hi,

I have the following error, while importing gnuradio from qtgui:

Alexanders-MacBook-Pro:Downloads alex$ python
Python 2.7.15 (default, May  2 2018, 00:53:27)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from gnuradio import qtgui
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gnuradio/qtgui/__init__.py", line 37, in <module>
    from range import Range, RangeWidget
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gnuradio/qtgui/range.py", line 67, in <module>
    class RangeWidget(QtGui.QWidget):
AttributeError: 'module' object has no attribute 'QWidget'
>>>

I've tried quite a bit of Googling, which lead me to the conclusion that there is a problem with the new gnuradio compatability distribution, however, there is no obvious fix for that. Could you, please, help me out with that?

Thanks,

  • Alex

Change History (22)

comment:1 Changed 6 years ago by mf2k (Frank Schima)

Cc: michaelld removed
Owner: set to michaelld
Status: newassigned

comment:2 Changed 6 years ago by angervision

Following invaluable recommendations from Michael, there is a possible workaround for this problem:

1) git clone --single-branch https://github.com/macports/macports-ports.git
2) cd macports-ports/
3) git checkout 278507714471d819cf55a2a4d228e484d39fde8e
4) cd python/py-pyqt4
5) sudo port install
6) sudo port activate py27-pyqt4 @4.12.1_2

comment:3 Changed 6 years ago by michaelld (Michael Dickens)

The best solution at this time is to revert back to py27-pyqt4 @4.12.1_2, which is step (6) above alone. I'm trying to figure out what's going on here & then how to fix it.

comment:4 Changed 6 years ago by simlt (Simon Mezzomo)

Same problem is present on my Mac after installing gnuradio @3.7.13.4_0.

Step(6) of the above workaround fails on my machine unfortunately. I think that if you didn't have py27-pyqt4@4.12.1_2 already installed on the machine it can't be activated, because the local macport installs the latest py27-pyqt4 @4.12.2_0 dependency anyways.

Is there a way to install the py27-pyqt4@4.12.1_2 dependency version separately?

Last edited 6 years ago by simlt (Simon Mezzomo) (previous) (diff)

comment:5 Changed 6 years ago by mf2k (Frank Schima)

Yes, you have to activate it directly:

sudo port activate py27-pyqt4@4.12.1_2

comment:6 in reply to:  5 Changed 6 years ago by simlt (Simon Mezzomo)

Replying to mf2k:

Yes, you have to activate it directly:

sudo port activate py27-pyqt4@4.12.1_2

Ty but this is what happens to me: Error: port activate failed: Registry error: py27-pyqt4 @4.12.1_2 is not installed.

comment:7 Changed 6 years ago by mf2k (Frank Schima)

Well you have to install it first.

comment:8 Changed 6 years ago by michaelld (Michael Dickens)

Yes if PyQt4 wasn't already installed before GR, then you can't activate it since that version doesn't exist. That said, you can install the prior version via "port": https://trac.macports.org/wiki/howto/InstallingOlderPort .

comment:9 Changed 6 years ago by michaelld (Michael Dickens)

Roughly (1) to (5) above. You can use commit "b2ef251fcbea9ce11848562532af3148fcaa5562" if you want to ; that's the one immediately prior to the PyQt4 update that's causing this issue.

comment:10 Changed 6 years ago by simlt (Simon Mezzomo)

Ok I think I managed to get it working now. The problem was that it needed also the "subport" option to correctly install the older but working py27-pyqt4 subport.

So step (6) actually needed, is instead

sudo port install subport=py27-pyqt4

And after some time I finally have the wanted version:

py27-pyqt4 @4.12.1_2 (active)
py27-pyqt4 @4.12.2_0

Now gnuradio works nicely! Thank you very much for the help.

comment:11 Changed 6 years ago by michaelld (Michael Dickens)

Awesome; glad that works! I'm still working on debugging & fixing the current release. Will post back here with more info when I have it.

comment:12 Changed 6 years ago by mbaldera-akamai

Hi there, just another data point:

I just happened to be switching to a new laptop with a pristine Mac OS High Sierra v10.13.6 install and thus also just happen to do a brand new install of macports (obviously). And furthermore, the only ports I had ever installed was exactly for gnuradio, gqrx, gr-osmosdr, and rtl-sdr... And I ran into the same no attribute QWidget issue from above.

I can confirm that following similar -revised- instructions from above fixed the problem for me:

git clone --single-branch https://github.com/macports/macports-ports.git
cd macports-ports/
git checkout 278507714471d819cf55a2a4d228e484d39fde8e
cd python/py-pyqt4
sudo port install
sudo port install subport=py27-pyqt4   ## This step being the key revision from previous comments above.

comment:13 Changed 6 years ago by michaelld (Michael Dickens)

Thanks for the updated instructions. I'm sure they will be useful for folks with this issue!

comment:14 Changed 6 years ago by eborisch (Eric A. Borisch)

Cc: eborisch added

comment:15 Changed 6 years ago by michaelld (Michael Dickens)

FYI that this issue isn't resolved by the latest PyQt4 release 4.12.3 . I haven't had time to figure out a better solution than just installing the older PyQt4 version. So, keep the old version active and/or around to be activated ... or, use the instructions above to install the prior version that works (4.12.1).

comment:16 Changed 6 years ago by eborisch (Eric A. Borisch)

How would you feel about updating the version "in ports" back to the working (4.12.1) version. This will require 'epoch 1' to be considered "an upgrade" but will get users back to a working installation rather than having users go though the hoops above...

comment:17 Changed 6 years ago by michaelld (Michael Dickens)

I'd be OK doing that, though I think the number of PyQt4 MP users being impacted is pretty small && the above commands seem to work quite reliably.

Let me see if I can find some time over the weekend to investigate this issue & if not then I'll do the reversion / epoch bump on Monday.

comment:18 Changed 6 years ago by eborisch (Eric A. Borisch)

Still broken with 4.12.3_0. Neither of the recommended ways to import work. Please revert to 4.12.1 until this has been fixed in MP's installation.

As I'm sure you're aware, 4.12.2 added a private sip. Something in how we're installing this clearly isn't working.

Thanks for any help!

comment:19 Changed 6 years ago by michaelld (Michael Dickens)

Yes; working on it.

Related: I find it odd/humorous that py*-QScintilla-qt4, which is provided by the same developer, fails to configure when the newer PyQt4. I'll email him & see what he says.

comment:20 Changed 6 years ago by michaelld (Michael Dickens)

In 6ff198d44950f8ff1cd8d03035ac29cb170796c9/macports-ports (master):

py*-pyqt4: revert version back to 4.12.1_2

Versions 4.12.2 and 4.12.3 change APIs (maybe remove some deprecated APIs) that cause incompatibilities with various dependent ports. As PyQt4 is somewhat of a critical port for many Qt4-related ports, we're reverting it back to the last known working version / revision.

Hopefully addresses:
+ #56993
+ #57087

comment:21 Changed 6 years ago by michaelld (Michael Dickens)

Please update your ports (sudo port selfupdate or sudo port sync or whatever script you prefer here). Then upgrade the outdated ports (sudo port upgrade outdated or whatever script you prefer here) to install the last known working version of py*-pyqt4 && it should fix this issue. Please report back success or failure.

comment:22 Changed 6 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: assignedclosed

The commit fixes this issue for me, and with lack of feedback I'm assuming it does for others too. Hence, I'm closing this ticket as fixed.

Note: See TracTickets for help on using tickets.