Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Numpy Install Mac Osx Python

I am using Python for my Linear Algebra course for programming. For the tools we need, I am trying to install NumPy. I used this website to guide me through the installation process.

I started from the links on SciPy's OS X page and eventually arrived at the SourceForge download site.

From there, I chose the Mac OS X installer numpy-1.6.1-py2.7-python.org-macosx10.3.dmg.

When I went to Idle and typed in

>>> import numpy as np

This is the error I received:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  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

I also tried it from the terminal and got the same error. I have a virtual environment installed - virtual env wrapper. I called the environment in the terminal by:

source my_new_env/bin/activate

And then I tried to import numpy in the terminal that way, but then I got the error:

(my_new_env) $ sudo python  -c 'import numpy; numpy.test()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named numpy

I am not sure if I installed NumPy incorrectly or if my virtual environment is conflicting with Nose. If anyone has suggestions let me know!

like image 670
Megan Avatar asked Feb 09 '13 20:02

Megan


1 Answers

i would skip the MacOS package install and use the 'pip install' instructions, since you're already familiar with virtualenvs. use these instructions instead: http://www.scipy.org/install.html#installing-via-pip

it's easier to work with a virtualenv and pip, which will ensure post-install that your virtualenv will have access to the modules you've installed. it takes more work to do that with an external package (or .dmg) that you've downloaded. not impossible, just more work. HTH.

like image 84
matias elgart Avatar answered Oct 04 '22 20:10

matias elgart