building numpy 1.6.2 on OSX 10.6 / Python2.7.3
import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/__init__.py",
Dear list, I am trying to build numpy 1.6.2 from source but am running up against a few problems. Platform: OSX10.6.8 Python: 2.7.3 (compiled using gcc 4.2.1) gcc: 4.2.1 gfortran: 4.2.1 I try the normal build sequence: python setup.py build sudo python setup.py install However, when I try to import numpy I get: 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): Symbol not found: _npy_ceil Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so Expected in: flat namespace in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so The numpy source was from the Sourceforge official page. When I run nm on the multiarray module I get: %nm /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so .......<snip a lot of stuff> U _npy_ceil U _npy_double_to_half U _npy_doublebits_to_halfbits U _npy_float_to_half U _npy_floatbits_to_halfbits U _npy_half_isnan U _npy_half_iszero U _npy_half_le U _npy_half_lt_nonan U _npy_half_to_double U _npy_half_to_float U _npy_halfbits_to_doublebits U _npy_halfbits_to_floatbits So it seems that the _npy_ceil symbol is undefined. I looked at /build/src.macosx-10.6-intel-2.7/numpy/core/include/numpy/config.h and it contains: #define HAVE_CEIL Am I doing something wrong? regards, Andrew -- _____________________________________ Dr. Andrew Nelson _____________________________________
Andrew, I'm afraid you did. It's generally considered a "very bad idea"(™) to install NumPy on a recent OSX system without specifying a destination. By default, the process will try to install on /Library/Frameworks/Python, overwriting the pre-installed version of NumPy that comes with your machine. You probably don't want to do that. However, using either the --user flag or a virtual environment ( http://www.virtualenv.org/ http://www.virtualenv.org/en/latest/) works pretty well. EG `python setup.py install --user` should install bumpy in a ~/.local directory, you'll just have to update your PYTHONPATH Good luck -- Pierre GM On Tuesday, August 7, 2012 at 08:15 , Andrew Nelson wrote: Dear list, I am trying to build numpy 1.6.2 from source but am running up against a few problems. Platform: OSX10.6.8 Python: 2.7.3 (compiled using gcc 4.2.1) gcc: 4.2.1 gfortran: 4.2.1 I try the normal build sequence: python setup.py build sudo python setup.py install However, when I try to import numpy I get:
import numpy
Traceback (most recent call last): File "<stdin>", 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): Symbol not found: _npy_ceil Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so Expected in: flat namespace in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so The numpy source was from the Sourceforge official page. When I run nm on the multiarray module I get: %nm /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so .......<snip a lot of stuff> U _npy_ceil U _npy_double_to_half U _npy_doublebits_to_halfbits U _npy_float_to_half U _npy_floatbits_to_halfbits U _npy_half_isnan U _npy_half_iszero U _npy_half_le U _npy_half_lt_nonan U _npy_half_to_double U _npy_half_to_float U _npy_halfbits_to_doublebits U _npy_halfbits_to_floatbits So it seems that the _npy_ceil symbol is undefined. I looked at /build/src.macosx-10.6-intel-2.7/numpy/core/include/numpy/config.h and it contains: #define HAVE_CEIL Am I doing something wrong? regards, Andrew -- _____________________________________ Dr. Andrew Nelson _____________________________________ _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
On Tue, Aug 7, 2012 at 5:00 AM, Pierre GM
It's generally considered a "very bad idea"(™) to install NumPy on a recent OSX system without specifying a destination. By default, the process will try to install on /Library/Frameworks/Python, overwriting the pre-installed version of NumPy that comes with your machine.
Indeed, you want to be careful about this, but Apple puts theirs in: /System/Library/Frameworks/Python.framework/ /Library/Frameworks... Is the default location for Python.org builds -- and a fine place to put it. (though you might have clashes if you try to install binaries build for the python.org builds But I wonder if this has anything to do with the OP's problem anyway... Sorry I'm not more help -- I've managed to avoid building python myself so far. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov
`python setup.py install --user` should install bumpy in a ~/.local directory, you'll just have to update your PYTHONPATH
As of Python 2.6/3.x, ~/.local is searched after is added before the system site directories but after Python's search paths and PYTHONPATH. See PEP 370 for more details if you're curious: http://www.python.org/dev/peps/pep-0370/ A
FWIW, on my OS X.6.8 system, using a brew-installed python, and installing into /usr/local/lib, the symbols appear to be present: ❯ nm /usr/local/lib/python2.7/site-packages/numpy/core/multiarray.so | grep ceil U _ceil U _ceilf U _ceill 00000000000c6550 T _npy_ceil 00000000000c6340 T _npy_ceilf 00000000000c6760 T _npy_ceill I agree with Dave, we're going to need to see your build log to have a better chance at diagnosing what went wrong with the build. A
participants (4)
-
Andrew Nelson
-
Aron Ahmadia
-
Chris Barker
-
Pierre GM