1

I am trying to install numpy on my mac machine. Whatever I try, I end up getting this error when trying to run my python code

 import numpy as np
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx- 
10.7-x86_64.egg/numpy/__init__.py", line 137, in <module>
 import add_newdocs
 File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx- 
10.7-x86_64.egg/numpy/add_newdocs.py", line 9, in <module>
 from numpy.lib import add_newdoc
 File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
 File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
 File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: dlopen(/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-
macosx-10.7-x86_64.egg/numpy/core/multiarray.so, 2): Symbol not found: _PyCapsule_Import
 Referenced from: /Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-10.7-x86_64.egg/numpy/core/multiarray.so
Expected in: flat namespace
 in /Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
 10.7-x86_64.egg/numpy/core/multiarray.so

Also when I enter Python in my terminal it takes me to python 2.6.1 version. How do I solve this?

Brock Adams
93.9k23 gold badges242 silver badges308 bronze badges
asked Mar 13, 2012 at 7:14

3 Answers 3

2

Based on the paths in the error message, it looks like you intended to install Numpy for a Python 2.7 that you've already installed. You're getting Python 2.6 instead. This suggests a problem with your PATH environment variable. Adjust the PATH variable in your .bash_profile so that the executables for the Python 2.7 appear before the system versions in /usr/bin.

answered Mar 13, 2012 at 13:58
1

I would recommend using macports or fink as a package system.

With macports, installing numpy is as easy as

cd /opt/local/bin 
sudo ./port install py27-numpy

where py27 may be replaced with your favorite python version.

answered Mar 13, 2012 at 10:07
0

If you want a fairly complete scientific python environment on your Mac I would recommend the EPD free Python distribution. That will give you numpy and scipy among others.

answered May 25, 2012 at 13:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.