Hi all!
I try to import hou module:
sys.path.append('/Library/Frameworks/Houdini.framework/Versions/10.0.249.5/Resources/houdini/scripts/python')
import hou
and got the next message:
ImportError: dlopen(/Library/Frameworks/Houdini.framework/Versions/10.0.249.5/Resources/houdini/scripts/python/_hou.so, 2): no suitable image found. Did find:
/Library/Frameworks/Houdini.framework/Versions/10.0.249.5/Resources/houdini/scripts/python/_hou.so: mach-o, but wrong architecture
OSX Version is 10.5.8
Python 2.5.1 (r251:54863, Feb 9 2009, 18:49:36)
What is the workaround?
Thanks all for the answer!
Problem to load hou module in the standart OSX Python
6636 7 1- stass3d
- Member
- 9 posts
- Joined:
- Offline
- graham
- Member
- 1922 posts
- Joined: 11月 2006
- Offline
- MartinAufinger
- Member
- 51 posts
- Joined: 8月 2011
- Offline
- graham
- Member
- 1922 posts
- Joined: 11月 2006
- Offline
- MartinAufinger
- Member
- 51 posts
- Joined: 8月 2011
- Offline
mhh. That would be a shame.
I am getting
if I use this script http://www.sidefx.com/docs/houdini12.5/hom/commandline#id489068 [sidefx.com] or the following if I just try to import hou
I am getting
/Library/Frameworks/Houdini.framework/Versions/12.5.427/Resources
Traceback (most recent call last):
File “enableHouModule.py”, line 31, in <module>
enableHouModule()
File “enableHouModule.py”, line 17, in enableHouModule
import DLFCN
ImportError: No module named DLFCN
if I use this script http://www.sidefx.com/docs/houdini12.5/hom/commandline#id489068 [sidefx.com] or the following if I just try to import hou
import hou
File “/Library/Frameworks/Houdini.framework/Versions/12.5.427/Resources/houdini/python2.6libs/hou.py”, line 18, in <module>
import _hou
ImportError: dlopen(/Library/Frameworks/Houdini.framework/Versions/12.5.427/Resources/houdini/python2.6libs/_hou.so, 2): Library not loaded: @rpath/libHoudiniAPPS2.dylib
Referenced from: /Library/Frameworks/Houdini.framework/Versions/12.5.427/Houdini
Reason: no suitable image found. Did find:
/Library/Frameworks/Houdini.framework/Versions/12.5.427/Libraries/libHoudiniAPPS2.dylib: GC capability mismatch
/Library/Frameworks/Houdini.framework/Versions/12.5.427/Resources/houdini/python2.6libs/../../../Libraries/libHoudiniAPPS2.dylib: GC capability mismatch
- PipelineFX
- Member
- 1 posts
- Joined: 9月 2006
- Offline
Getting this error again with Houdini 14.0.258 running on OS X 10.8.5. This used to work with Houdini 11 and 12.
The section mucking with DYLD_LIBARY_PATH is me trying to get it working with Houdini 14:
————————————————–
/bin/tcsh -c
setenv VERSIONER_PYTHON_VERSION 2.6
setenv VERSIONER_PYTHON_PREFER_32_BIT no
cd /Library/Frameworks/Houdini.framework/Versions/14.0.258/Resources
source houdini_setup
/usr/bin/python -u /Applications/pfx/qube/api/python/qb/backend/child_bootstrapper.py –port 62619 –kind houdini
————————————————–
houdiniPy> print
houdiniPy> import sys
houdiniPy> import os
houdiniPy> import time
houdiniPy> import sys, os
houdiniPy>
def enableHouModule():
import sys,os
if sys.platform == ‘linux2’ and hasattr(sys, “setdlopenflags”):
old_dlopen_flags = sys.getdlopenflags()
import DLFCN
sys.setdlopenflags(old_dlopen_flags | DLFCN.RTLD_GLOBAL)
try:
import hou
except ImportError:
# Add $HFS/houdini/python2.xlibs to sys.path so Python can find the
# hou module.
sys.path.append(os.environ + “/houdini/python%d.%dlibs” % sys.version_info)
if sys.platform == ‘darwin’:
lib_path = ‘%s/Libraries’ % os.environ.replace('/Resources', ‘')
if ’DYLD_LIBRARY_PATH' in os.environ:
os.environ = ‘%s:%s’ % (os.environ.get('DYLD_LIBRARY_PATH', ''), lib_path)
else:
os.environ = lib_path
print ‘DEBUG: DYLD_LIBRARY_PATH = %s’ % os.environ
print ‘DEBUG: dylib = %s’ % (os.path.join(lib_path, ‘libHoudiniOPZ.dylib’))
print ‘DEBUG: dylib libHoudiniOPZ.dylib exists: %s’ % os.path.exists(os.path.join(lib_path, ‘libHoudiniOPZ.dylib’))
import hou
finally:
if sys.platform == ‘linux2’ and hasattr(sys, “setdlopenflags”):
sys.setdlopenflags(old_dlopen_flags)
houdiniPy> enableHouModule()
DEBUG: DYLD_LIBRARY_PATH = /Library/Frameworks/Houdini.framework/Versions/14.0.258/Libraries
DEBUG: dylib = /Library/Frameworks/Houdini.framework/Versions/14.0.258/Libraries/libHoudiniOPZ.dylib
DEBUG: dylib libHoudiniOPZ.dylib exists: True
——————————————————————————–
houdiniPy> import hou
ERROR: enableHouModule()
——————————————————————————–
Traceback (most recent call last):
File “/Applications/pfx/qube/api/python/qb/backend/pythonChildHandler.py”, line 598, in mainloop
result = self.execute(cmd)
File “/Applications/pfx/qube/api/python/qb/backend/pythonChildHandler.py”, line 552, in execute
exec cmd in self.globals, self.locals
File “<string>”, line 1, in <module>
File “<string>”, line 27, in enableHouModule
File “/Library/Frameworks/Houdini.framework/Versions/14.0.258/Resources/houdini/python2.6libs/hou.py”, line 18, in <module>
import _hou
ImportError: dlopen(/Library/Frameworks/Houdini.framework/Versions/14.0.258/Resources/houdini/python2.6libs/_hou.so, 2): Library not loaded: @rpath/libHoudiniOPZ.dylib
Referenced from: /Library/Frameworks/Houdini.framework/Versions/14.0.258/Resources/houdini/python2.6libs/_hou.so
Reason: image not found
——————————————————————————–
The section mucking with DYLD_LIBARY_PATH is me trying to get it working with Houdini 14:
————————————————–
/bin/tcsh -c
setenv VERSIONER_PYTHON_VERSION 2.6
setenv VERSIONER_PYTHON_PREFER_32_BIT no
cd /Library/Frameworks/Houdini.framework/Versions/14.0.258/Resources
source houdini_setup
/usr/bin/python -u /Applications/pfx/qube/api/python/qb/backend/child_bootstrapper.py –port 62619 –kind houdini
————————————————–
houdiniPy> print
houdiniPy> import sys
houdiniPy> import os
houdiniPy> import time
houdiniPy> import sys, os
houdiniPy>
def enableHouModule():
import sys,os
if sys.platform == ‘linux2’ and hasattr(sys, “setdlopenflags”):
old_dlopen_flags = sys.getdlopenflags()
import DLFCN
sys.setdlopenflags(old_dlopen_flags | DLFCN.RTLD_GLOBAL)
try:
import hou
except ImportError:
# Add $HFS/houdini/python2.xlibs to sys.path so Python can find the
# hou module.
sys.path.append(os.environ + “/houdini/python%d.%dlibs” % sys.version_info)
if sys.platform == ‘darwin’:
lib_path = ‘%s/Libraries’ % os.environ.replace('/Resources', ‘')
if ’DYLD_LIBRARY_PATH' in os.environ:
os.environ = ‘%s:%s’ % (os.environ.get('DYLD_LIBRARY_PATH', ''), lib_path)
else:
os.environ = lib_path
print ‘DEBUG: DYLD_LIBRARY_PATH = %s’ % os.environ
print ‘DEBUG: dylib = %s’ % (os.path.join(lib_path, ‘libHoudiniOPZ.dylib’))
print ‘DEBUG: dylib libHoudiniOPZ.dylib exists: %s’ % os.path.exists(os.path.join(lib_path, ‘libHoudiniOPZ.dylib’))
import hou
finally:
if sys.platform == ‘linux2’ and hasattr(sys, “setdlopenflags”):
sys.setdlopenflags(old_dlopen_flags)
houdiniPy> enableHouModule()
DEBUG: DYLD_LIBRARY_PATH = /Library/Frameworks/Houdini.framework/Versions/14.0.258/Libraries
DEBUG: dylib = /Library/Frameworks/Houdini.framework/Versions/14.0.258/Libraries/libHoudiniOPZ.dylib
DEBUG: dylib libHoudiniOPZ.dylib exists: True
——————————————————————————–
houdiniPy> import hou
ERROR: enableHouModule()
——————————————————————————–
Traceback (most recent call last):
File “/Applications/pfx/qube/api/python/qb/backend/pythonChildHandler.py”, line 598, in mainloop
result = self.execute(cmd)
File “/Applications/pfx/qube/api/python/qb/backend/pythonChildHandler.py”, line 552, in execute
exec cmd in self.globals, self.locals
File “<string>”, line 1, in <module>
File “<string>”, line 27, in enableHouModule
File “/Library/Frameworks/Houdini.framework/Versions/14.0.258/Resources/houdini/python2.6libs/hou.py”, line 18, in <module>
import _hou
ImportError: dlopen(/Library/Frameworks/Houdini.framework/Versions/14.0.258/Resources/houdini/python2.6libs/_hou.so, 2): Library not loaded: @rpath/libHoudiniOPZ.dylib
Referenced from: /Library/Frameworks/Houdini.framework/Versions/14.0.258/Resources/houdini/python2.6libs/_hou.so
Reason: image not found
——————————————————————————–
- marsupial
- Member
- 2 posts
- Joined: 5月 2006
- Offline
I don't think it's possible using DYLD_LIBRARY_PATH as theres a few competing library versions between Houdini and the OS (at least for 10.10). I've been able to get it working by changing where _hou.so looks for it's libraries. But this might only be a good solution locally.
installNameChanges()
{
# installNameChanges <file> <replace> <with>
otool -L "$1" | while read line; do
echo "$line" | grep -q "$2"
if [ $? -eq 0 ]; then
lib=$(echo ${line} | awk -F''"$2"'| ' '{print $2}')
if [ -n "$4" ]; then
echo install_name_tool -change "$2$lib" "$3/$lib" "$1"
else
sudo install_name_tool -change "$2$lib" "$3/$lib" "$1"
fi
fi
done
}
installNameChanges "${HFS}/houdini/python2.6libs/_hou.so" @rpath/ @loader_path/../../../Libraries/
installNameChanges "${HFS}/houdini/python2.7libs/_hou.so" @rpath/ @loader_path/../../../Libraries/
- NFX
- Member
- 183 posts
- Joined: 12月 2011
- Offline
marsupial
I don't think it's possible using DYLD_LIBRARY_PATH as theres a few competing library versions between Houdini and the OS (at least for 10.10). I've been able to get it working by changing where _hou.so looks for it's libraries. But this might only be a good solution locally.installNameChanges()
{
# installNameChanges <file> <replace> <with>
otool -L "$1" | while read line; do
echo "$line" | grep -q "$2"
if [ $? -eq 0 ]; then
lib=$(echo ${line} | awk -F''"$2"'| ' '{print $2}')
if [ -n "$4" ]; then
echo install_name_tool -change "$2$lib" "$3/$lib" "$1"
else
sudo install_name_tool -change "$2$lib" "$3/$lib" "$1"
fi
fi
done
}
installNameChanges "${HFS}/houdini/python2.6libs/_hou.so" @rpath/ @loader_path/../../../Libraries/
installNameChanges "${HFS}/houdini/python2.7libs/_hou.so" @rpath/ @loader_path/../../../Libraries/
I have been running into this issue while trying to integrate houdini into our mac based pipeline. This shell script solution almost works. I ran a test where it only would echo back the intended changes and it looked perfect, however when I reenabled the sudo, I got back this error:
changing install names or rpaths can't be redone for: /Library/Frameworks/Houdini.framework/Versions/15.0.416/Resources/houdini/python2.7libs/_hou.so (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)
As far as I can make out, -headerpad_max_install_names is a linker flag that has to be enabled on compile in order to allow install_name_tool to replace paths with longer ones. If this is the case it seems like something that Sidefx would have to fix since we can't recompile the binaries. Hopefully someone can tell me I am wrong though?
Anyways, I would love to hear if anyone has figured a way to get the hou module to import from the terminal. Has Sidefx announced any plans to fix this?
-
- Quick Links