[Chimera-users] Numeric/numpy revisited
Randy Heiland
heiland at indiana.edu
Thu Jan 11 13:17:27 PST 2007
I'll post this long-winded thing to the users list although it's really for
the developers...
I'm revisiting the issue of wanting to have access to the numpy pkg
(numpy.scipy.org) for a Chimera plugin - a delayed continuation of the
problem discussed here:
http://www.cgl.ucsf.edu/pipermail/chimera-users/2006-April/000743.html
Here's my situation:
I installed chimera-1.2304-osx_x11.dmg. I then built the numpy pkg (from
svn) using my system's python (2.4) via 'python setup.py build' and copied
the resulting /numpy dir into the chimera /share dir.
I then discover/verify 2 things:
1) using my system's python, I can successfully import both Numeric and
numpy - Numeric coming from chimera and the numpy that I just built and
copied into chimera's /share dir
2) using the python2.4 bundled with chimera, I cannot import both Numeric
and numpy. I can always import one (either one), but then get a bizarre
error when trying to import the other.
---------------------------
More verbosely:
I set PYTHONPATH to
/Applications/Chimera.app/Contents/Resources/lib/python2.4/site-packages/Num
eric:/Applications/Chimera.app/Contents/Resources/share
Then check the system python:
[macmini:~] heiland% pwd
/Users/heiland
[macmini:~] heiland% which python
/usr/local/bin/python
[macmini:~] heiland% ll /usr/local/bin/python
lrwxr-xr-x 1 root heiland 68 Jul 27 06:19 /usr/local/bin/python@ ->
../../../Library/Frameworks/Python.framework/Versions/2.4/bin/python
[macmini:~] heiland% python
Python 2.4.3 (#1, Apr 7 2006, 10:54:33)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Numeric
>>> import numpy
>>> from numpy.core.multiarray import typeinfo
>>>
Then check the chimera python:
/Applications/Chimera.app/Contents/Resources/share
[macmini:Contents/Resources/share] heiland% ../bin/python2.4
Python 2.4.3 (#1, Oct 16 2006, 09:43:37)
[GCC 4.0.1 (Apple Computer, Inc. build 5247)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Numeric
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/Applications/Chimera.app/Contents/Resources/share/numpy/__init__.py", line
36, in ?
import core
File "numpy/core/__init__.py", line 8, in ?
import numerictypes as nt
File "numpy/core/numerictypes.py", line 83, in ?
from multiarray import typeinfo, ndarray, array, empty, dtype
ImportError: cannot import name typeinfo
-----------------------------
OK, it then dawns on me that probably what I really should be doing is
building numpy using chimera's python. So, after downloading the chimera
(1.2318) OSX headers (http://www.cgl.ucsf.edu/chimera/sourcecode.html ),
putting the /include in the /Resources dir, and doing:
/Applications/Chimera.app/Contents/Resources/bin/python2.4 setup.py build
It all builds fine, but then I have the same bizarre error when trying to
import both Numeric and numpy as before. Crap.
So I then use 'ldd' to see the dependencies in the different python
executables:
ldd /Applications/Chimera.app/Contents/Resources/bin/python2.4
/Applications/Chimera.app/Contents/Resources/bin/python2.4:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 71.1.3)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 7.3.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)
/usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version
47.1.0)
[macmini:~] heiland% ldd
/Library/Frameworks/Python.framework/Versions/2.4/bin/python
/Library/Frameworks/Python.framework/Versions/2.4/bin/python:
/usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version
47.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 88.1.3)
Note the different versions on the libSystem.B.dylib. Some more poking...
[macmini:~] heiland% locate libgcc_s.1.dylib
/Developer/SDKs/MacOSX10.3.9.sdk/usr/lib/libgcc_s.1.dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libgcc_s.1.dylib
/usr/lib/libgcc_s.1.dylib
[macmini:~] heiland% ldd
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libgcc_s.1.dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libgcc_s.1.dylib:
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 88.3.3)
[macmini:~] heiland% ldd
/Developer/SDKs/MacOSX10.3.9.sdk/usr/lib/libgcc_s.1.dylib
/Developer/SDKs/MacOSX10.3.9.sdk/usr/lib/libgcc_s.1.dylib:
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 71.1.3)
[macmini:~] heiland% ldd /usr/lib/libgcc_s.1.dylib
/usr/lib/libgcc_s.1.dylib:
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 88.1.2)
-----------------------------
One thing worth noting is the different gcc builds (my system python used a
later build, 5250, cf 5247 for chimera's python). I also installed the
latest xcode (2.4.1) before doing all this.
If you've stayed with me to the end, I congratulate you :)
Basic question - any ideas? Would it be possible for the Chimera OSX
developers to verify they have the latest xcode? And secondly, do you know
how one can the chimera python have the dependency on libSystem.B.dylib
v.88.1.2 instead of 71.1.3 ?
Thanks,
-Randy
Fwiw, this link
http://mail.python.org/pipermail/pythonmac-sig/2006-April/017310.html seems
related to this thread also.
More information about the Chimera-users
mailing list