Jump to content

Python versions and PyQt


TomRaynor

Recommended Posts

I have had a fairly extensive look around in an attempt to find out whether I can get PyQt4 working in Houdini13 on my Macbook Pro.

 

The docs say that in versions of Houdini later than H11, Houdini "tries to match the version of Python installed on the current system".

 

http://www.sidefx.com/docs/houdini13.0/news/11/python

 

In my Houdini session, if I try typing:

 

import sys

sys.version

 

It tells me:

 

'2.7.5 (default, Sep 12 2013.........'

 

So does this mean that Houdini is using python version 2.7.5? I have seen a lot of posts on the web about how "Houdini 11 does not support Python 2.7" (Graham in 2011), so I am a little confused. Admittedly a lot of the posts I have seen have been a couple of years old:

 

http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=102608&sid=ddc19cb0e0a4d6bd9e1010c41c4d595a

 

When I run python in a shell, it tells me that I am using 2.7.6. I have installed PyQt4 for this version of python and I can run a command in the terminal such as "from PyQt4 import QtCore" with no errors.

When I try and run the same command in the python shell in Houdini I get the following error:

 

Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/PyQt4/QtCore.so, 2): Library not loaded: /opt/local/Library/Frameworks/QtCore.fra
mework/Versions/4/QtCore
  Referenced from: /Library/Python/2.7/site-packages/PyQt4/QtCore.so
  Reason: no suitable image found.  Did find:
        /opt/local/Library/Frameworks/QtCore.framework/Versions/4/QtCore: GC capability mismatch
        /Library/Frameworks/QtCore.framework/Versions/4/QtCore: GC capability mismatch
 
Weirdly if I run "import PyQt4" in the houdini python shell it imports fine. So it seems to just be having an issue with the QtCore module.
I am completely at a loss for what to do to get this import statement to work in Houdini on my mac and get PyQt going...
 
Any help would be much appreciated.
Thanks.

 

 

Link to comment
Share on other sites

http://www.sidefx.com/docs/houdini13.0/hom/

 

This is more up to date.

 

 

On Mac OS X and Linux, Houdini uses the system’s Python. On Windows, it uses the version of Python installed with Houdini.

On Linux, Houdini does not look at $PATH when trying to search and load the Python library. Instead it searches all the paths in $LD_LIBRARY_PATH, then /lib and then /usr/lib. If it can’t find a suitable Python library in the system, then it defaults to the one in $HFS. If your Python library is not in a standard location, you should add its directory path to $LD_LIBRARY_PATH.

 

Basicly if it don't find any usable python in the system it uses the one it ships with.

 

The reason why import PyQt4 works is because it don't actually load any of PyQt. The __init__.py file just contains some license information.

 

On why it's not working I think it's because it don't find Qt. Have you installed? If yes you might need to add installation location to DYLD_LIBRARY_PATH.

 

Cheers,

Erik

Link to comment
Share on other sites

But if python is using my system's version of python and in the terminal I am able to type the following with no errors:


 


>>> import sys


>>> sys.version


'2.7.6 (default, Nov 18 2013, 15:12:51) \n[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)]'


>>> from PyQt4 import QtCore


>>>


 


 


Then why am I not able to do this in Houdini?


Link to comment
Share on other sites

Hmmm, so do I need to either get Houdini to somehow pick up and use my system's python (2.7.6) as opposed to it's built in 2.7.5? And if so, why would it not be picking it up and how do I force it to pick it up?

 

Or

 

How do I get PyQt4 installed for 2.7.5? I thought I installed it for python2.7, does that not mean it gets installed for ALL versions of python 2.7  (both 2.7.5 and 2.7.6)?

Link to comment
Share on other sites

If you install it in your system it gets installed for your system python and not the houdini python.

 

import sys
print sys.executable
 
This should output the same from both houdini and a terminal.
 
I did however just compile PyQt myself to try and get it working and got stuck at the same error. I then googled a bunch and what Graham says in your link seems to be still valid.
Houdini for OSX is compiled in some way that it's not possible to use either PyQt4 or PySide.
 
Shotgun got the same text on their website.
 
Guess you are stuck with native houdini UI.
Link to comment
Share on other sites

Here is some information I got from sidefx a while ago. I have not tried compiling qt with these flags, I just gave up.

 

Cheers,

Koen

 

--

 

Side Effects Support Ticket: #18072

Also, Houdini is compiled with objective-C garbage collection turned on.

So the only way to get PySide to work with Houdini on Mac is to build the Qt libraries from source with the '-fobjc-gc' flag added to the objective-c compiler line. This requires patching a couple of files in Qt's qmake build system.

 

Link to comment
Share on other sites

Here is some information I got from sidefx a while ago. I have not tried compiling qt with these flags, I just gave up.

 

Cheers,

Koen

 

--

 

Side Effects Support Ticket: #18072

Also, Houdini is compiled with objective-C garbage collection turned on.

So the only way to get PySide to work with Houdini on Mac is to build the Qt libraries from source with the '-fobjc-gc' flag added to the objective-c compiler line. This requires patching a couple of files in Qt's qmake build system.

 

 

Did they supply the patches? If they did it should be fairly easy to get it going. 

I would so love if sidefx just included PySide as the foundry does. It makes my life so much easier.

Link to comment
Share on other sites

I'm unfortunately getting to the point where I am so confused that I am close to giving up with this whole thing, which is a shame as it would be great to get this working.

And I feel like many have done the same before me because of this issue...

 

If anyone from SideFX is listening in and has a view on what is possible/not possible with PyQt and Houdini on Mac it would be great to hear about as well as what to do if it is possible to get it working.

Thanks for your input Koen and Eric.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...