Opened 15 years ago

Closed 12 years ago

Last modified 8 years ago

#22247 closed defect (worksforme)

though, it's installed, python can't find pyqt4

Reported by: anatuss@… Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 1.8.1
Keywords: Cc: root42, ultramagneus@…
Port: py26-pyqt4

Description

Hi, I'm using epd because of chaco (unfortunately it isn't available on macports). Recently I've started using QtDesigner with the intention to convert it into python language. But it isn't available on the epd. Hence I installed it with macports. Everything works fine until I tried to convert. I'm not good at making binaries work out. (I'd be glad if anyone could tell me what to do.)

 ~> pyuic4-2.6 
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/pyuic.py", line 4, in <module>
    from PyQt4 import QtCore
ImportError: No module named PyQt4

Change History (33)

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

Port: PyQt4 removed

What is the result of the following command?

port installed py26-pyqt4 python26 qt4-mac python_select

Also, what version of Mac OS X and Xcode are you running?

comment:2 Changed 15 years ago by anatuss@…

Everything is up to date.... Mac OSX 10.6 and the Xcode version, which was necessary for installing 1.8.1 ... (Am I supposed to have a newer one ?)

The following ports are currently installed:
  py26-pyqt4 @4.6.1_0 (active)
  python26 @2.6.3_1+darwin (active)
  python_select @0.3_0+darwin_10 (active)
  qt4-mac @4.5.3_0+darwin_10 (active)

comment:3 Changed 15 years ago by mf2k (Frank Schima)

That looks good. What is the output of the following command?

python_select -s

comment:4 Changed 15 years ago by jmroot (Joshua Root)

Owner: changed from macports-tickets@… to saispo@…
Port: py26-pyqt4 added

comment:5 Changed 15 years ago by anatuss@…

python26 ... wie zu erwarten war

comment:6 Changed 15 years ago by anatuss@…

sorry about that ...

comment:7 Changed 15 years ago by Veence (Vincent)

Welche Files gibt es in .../Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/ ? (OOps, sorry for the German ;))

comment:8 Changed 15 years ago by anatuss@…

/o/l/L/F/P/V/2/l/p/s/PyQt4> ls
Qt.so            QtDesigner.so    QtNetwork.so     QtScriptTools.so QtTest.so        QtXmlPatterns.so pyqtconfig.py
QtAssistant.so   QtGui.so         QtOpenGL.so      QtSql.so         QtWebKit.so      __init__.py      uic
QtCore.so        QtHelp.so        QtScript.so      QtSvg.so         QtXml.so         _qt.so

/o/l/L/F/P/V/2/l/p/s/PyQt4> ls uic/
Compiler       __init__.py    exceptions.py  objcreator.py  port_v3        pyuic.py       widget-plugins
Loader         driver.py      icon_cache.py  port_v2        properties.py  uiparser.py

To make PyQt work one needs to "configure" sip. This works for me. But ...

/o/l/L/F/P/V/2/l/p/s/PyQt4> python2.6 pyqtconfig.py 
Traceback (most recent call last):
  File "pyqtconfig.py", line 32, in <module>
    import sipconfig
ImportError: No module named sipconfig

Though it's one directory up. I guess (but I don't know how to do this. I'd be glad to get a clue) the packages aren't "registered". Maybe one needs to use sys and change the path.

comment:9 Changed 15 years ago by anatuss@…

well, I guess everyone knows how to deal with the last mentioned one. ... Of course, It works out. I've simple added

import sys sys.path.append('..')

After looking there's no PyQt4.py in there. So it cannot work ... Hence I've no idea to handle this ...

comment:10 Changed 15 years ago by Veence (Vincent)

Can you check the .so files in your /o/l/L/F/P/V/2/l/p/s/PyQt4 are of the same arch as the python binary? Just type:

file Qt.so
file .../python2.6

and verify that they are suitable for the same arch.

comment:11 Changed 15 years ago by anatuss@…

file Qt.so
Qt.so: Mach-O 64-bit bundle x86_64

file /System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6: Mach-O universal binary with 3 architectures
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 (for architecture x86_64):	Mach-O 64-bit executable x86_64
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 (for architecture i386):	Mach-O executable i386
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 (for architecture ppc7400):	Mach-O executable ppc

So I guess, it suits

comment:12 Changed 15 years ago by Veence (Vincent)

What about Qt itself? What is the result of:

file .../frameworks/QtCore.framework/Versions/4/QtCore
}}} ?

comment:13 Changed 15 years ago by anatuss@…

file QtCore
QtCore: Mach-O 64-bit dynamically linked shared library x86_64

comment:14 Changed 15 years ago by root42

Cc: arne.schmitz@… added

Cc Me!

comment:15 Changed 15 years ago by root42

I have the same error, using py26-pyqt4, python2.6 from MacPorts. The problem is, that pyuic4-2.6 runs /usr/bin/pythonw, which starts the OS X native python interpreter, which does not know about the PyQt package from MacPorts. How can we change that? How does one select the python interpreter to use?

comment:16 Changed 14 years ago by mf2k (Frank Schima)

I cannot reproduce this. Are you still seeing this problem with the latest version of py26-pyqt4?

comment:17 Changed 14 years ago by mf2k (Frank Schima)

Resolution: worksforme
Status: newclosed

No response, closing.

comment:18 Changed 14 years ago by strassh@…

Resolution: worksforme
Status: closedreopened

I experience the same issue (all ouput commands describe in this post looks quite the same. I can't launch any pyQt programs (ImportError: No module named PyQt4) and python2.6 pyqtconfig.py can't be launched either.

$ port installed py26-pyqt4 python26 qt4-mac python_select
The following ports are currently installed:
  py26-pyqt4 @4.8.1_0 (active)
  python26 @2.6.6_0+no_tkinter (active)
  python_select @0.3_0 (active)
  qt4-mac @4.7.1_0+quartz (active)

$ python_select -s
python26

Thanks

comment:19 Changed 14 years ago by jmroot (Joshua Root)

Owner: changed from saispo@… to michaelld@…
Status: reopenednew

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

Can someone give me a command-line to execute so that I can understand the issue? For me running python & then "import PyQt4" works just fine ... but maybe this is a "pyuic4" issue instead?

comment:21 in reply to:  18 Changed 14 years ago by mf2k (Frank Schima)

Replying to strassh@…:

What is the output of the following?

which pyuic4-2.6

Also what is the output if you run "ls -l" on the result?

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

Here is what I get:

bash% which pyuic4-2.6 
/opt/local/bin/pyuic4-2.6

bash% ls -l `which pyuic4-2.6`
lrwxr-xr-x  1 root  wheel  70 Oct 17 20:18 /opt/local/bin/pyuic4-2.6@ -> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/pyuic4

comment:23 Changed 14 years ago by michaelld (Michael Dickens)

@anatuss@…: Is this still an issue for you? If so, are your ports up to date? A lot has changed since this ticket was issued. "sudo port selfupdate" and then "sudo port upgrade outdated" often takes care of these older issues.

comment:24 Changed 13 years ago by ultramagneus@…

I appear to be experiencing this issue, despite installing py27-pyqt4 via macports, I receive the error "ImportError: No module named PyQt4"

comment:25 Changed 13 years ago by ultramagneus@…

Cc: ultramagneus@… added

Cc Me!

comment:26 Changed 12 years ago by michaelld (Michael Dickens)

If this ticket is still valid, can you do the following:

sudo port clean py26-pyqt4
sudo port selfupdate

and then try to install or upgrade py26-pyqt4 again. There's a new qt4-mac and py26-pyqt4 that will hopefully fix this issue.

comment:27 Changed 12 years ago by michaelld (Michael Dickens)

In the past few months, qt4-mac, phonon, and py27-pyqt4 have all been updated. Maybe these updates have fixed the issue of this ticket?

comment:28 Changed 12 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: newclosed

Closing due to lack of response, and that the issue should be fixed in the latest py-pyqt4 port.

comment:29 in reply to:  28 Changed 12 years ago by rif.a.saurous@…

Resolution: fixed
Status: closedreopened

Replying to michaelld@…:

Closing due to lack of response, and that the issue should be fixed in the latest py-pyqt4 port.

comment:30 Changed 12 years ago by rif.a.saurous@…

I am definitely experiencing this. I did a 'sudo port install py27-pyqt4'. It compiled for awhile, no error message. Then:

/usr/local/bin/pythonw Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import PyQt4

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

ImportError: No module named PyQt4

comment:31 Changed 12 years ago by rif.a.saurous@…

Whoops, wrong version of python. If I use /opt/local/bin/python2.7 it works.

comment:32 Changed 12 years ago by michaelld (Michael Dickens)

Resolution: worksforme
Status: reopenedclosed

I'm glad it's now verified working. Closing again.

comment:33 Changed 8 years ago by posines@…

I have the same problem again.

$ sudo port install py27-pyqt4
--->  Computing dependencies for py27-pyqt4
--->  Cleaning py27-pyqt4
--->  Scanning binaries for linking errors
--->  No broken files found.

When run Python 2.7.9:

In [1]: import PyQt4
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-0c3b8c686717> in <module>()
----> 1 import PyQt4

ImportError: No module named PyQt4
Note: See TracTickets for help on using tickets.