pythonperlr
pythonperlr

Reputation: 13

can't import NumPy Mac OS X Lion

I searched around and I haven't solve my questions. So plz help me. Thanks! I want to install HTSeq, and it requires Python 2.5 (or later) and NumPy. I have installed Xcode 4.2.1 before, my OS is Mac OS X Lion 10.7.2. When the installations of Python(2.7.2) and NumPy(numpy-1.6.1-py2.7-python.org-macosx10.3.dmg) finished, I ran Python, and tried to import numpy, it appeared as follows:

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.


>>> import numpy

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import numpy
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/__init__.py", line 137, in <module>
    import add_newdocs
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/__init__.py", line 4, in <module>
    from type_check import *
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/__init__.py", line 5, in <module>
    import multiarray
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found.  Did find:
    /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper

Upvotes: 1

Views: 5783

Answers (1)

thm
thm

Reputation: 41

I had the same problem as well: Mac OS 10.7.3, freshly downloaded Python 2.7.2 from python.org, and numpy 1.6.1 via scipy.org, specifically the version for Python 2.7. I got the exact same error message as the original poster.

I believe this has to do with "architecture" issues--that the numpy .dmg download from sourceforge is 32-bit, and python defaults to 64-bit when its run.

In any case, the solution that worked for me was to get the Scipy Superpack. Much to my surprise, it worked! The README for the Superpack says that it needs Xcode 4.2, but I don't have that installed (I do have XCode 3.0). Now when I run IDLE, it says:

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)

and

>>> numpy.version.version
'1.7.0.dev-3f685a1'
>>> scipy.version.version
'0.11.0.dev-491f9db'

Since I found this thread as I was trying to find a solution, and posted my answer as soon as I got the above result, I don't know how well it works, but this does look like progress.

Upvotes: 4

Related Questions