How to install numpy and scipy on OSX?
Solution 1
Sounds as though you might be trying to use a 32-bit library from a 64-bit Python. Looks like there's an unofficial 64-bit Numpy available for Snow Leopard.
EDIT: The Python 2.6 .dmg available here is indeed 32-bit. (Specifically, it's a universal binary containing both i386 and ppc versions). The same is true of the regular numpy and scipy .dmg releases available here. (How do I know? See below!) So if you use those releases together you should be fine.
But you're not fine - so my guess is you're not using the version of Python from the 2.6 .dmg you downloaded. If you're running an executable python script, e.g.:
$ ./my-script.py
then you could try specifying the Python you're using explicitly on the command line. Looks like the MacPython .dmg installs to /usr/local/bin/python, so try:
$ /usr/local/bin/python2.6 myscript.py
Any joy?
How I determined the architecture the contents of those .dmg files are built for...
- Mount the .dmg (i.e. double-click it to open a volume)
-
Use gunzip and pax to unpack the package contents to a local directory, e.g.:
$ mkdir tmp $ cd tmp $ gunzip -c /Volumes/Universal\ MacPython\ 2.6/MacPython.mpkg/Contents/Packages/PythonUnixTools-2.6.pkg/Contents/Archive.pax.gz | pax
-
Use
file
to examine binary files in the package contents$ file Versions/2.6/bin/python Versions/2.6/bin/python: Mach-O universal binary with 2 architectures Versions/2.6/bin/python (for architecture ppc): Mach-O executable ppc Versions/2.6/bin/python (for architecture i386): Mach-O executable i386
Solution 2
I had the same error message when I was trying my freshly-installed numpy and scipy in python2.7 on Mac OSX 10.6.8 . Later I found out that there were two .dmg for python2.7:
- numpy-1.6.2-py2.7-python.org-macosx10.3.dmg
- numpy-1.6.2-py2.7-python.org-macosx10.6.dmg
It was the package in 10.3.dmg giving me the error message about multiarray.so. After installing the one in 10.6.dmg, I got rid of this error message.
Solution 3
I had problems with numpy until I installed in a virtualenv, now I don't have any issues. I would definitely suggest trying that.
Solution 4
for snow leopard 64 bit i used the following man http://blog.hyperjeff.net/?p=160 just execute and you are good to go. Also look at the comments ( new AMD ...)
building numpy works all the time. but for scipy you need to provide the numpy config files. install gfortran .....
goh
Updated on June 15, 2022Comments
-
goh almost 2 years
I'm new to Mac so please bear with me.
I'm using snow leopard 10.6.4 at the moment.
I want to install numpy and scipy, so I downloaded the python2.6,numpy and scipy dmg files from their official site. However, I'm having problem import numpy:
Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper
Can anyone shed some light to this problem?
-
Simon Whitaker over 13 yearsActually, the best way to manage packages on OS X is Homebrew (not Fink or MacPorts :)) - which unfortunately lists neither NumPy now SciPy at the current time. :)
-
Josh Bleecher Snyder over 13 yearsWow. I had no idea there was such competition over OS X package managers. (Just got my first ever down vote!) Do you know if Fink and MacPorts can cohabit without fighting, so that I can play with it a little?
-
goh over 13 yearsisn't the python installer from python.org built as 32-bit?
-
Benjamin over 13 yearsWhat code gave you the error you listed above? Had you previously tried to build any of those packages yourself? You might want to delete the numpy and scipy folders from site-packages completely and try again.
-
Velociraptors over 13 yearsEven if the python.org installer is 32-bit, the OS X python (installed by default) is probably 64-bit.
-
Bruno Feroleto over 13 years@Josh: I guess that you can have both MacPorts and Darwin packages installed at the same time: Fink installs everything in a dedicated /sw directory, as far as I know.
-
Ned Deily over 13 yearsThere is no direct conflict between MacPorts and Fink packages as they are installed to different roots by default,
/opt/local/
and/sw
respectively. However there are some packages available in either or both whose vanilla installation process try to be clever by looking for 3rd-party libraries in both MacPorts and Fink default locations and which may not have been customized by MacPorts or Fink to prevent that, which can result in a package using a mismatch of libraries from the wrong package manager and failing in execution because of incompatible build options (archs, etc). -
Ned Deily over 13 years... For that reason, it is generally not a good idea to have the same packages or packages dependencies installed from more than one package manager (or from source yourself, say, to /usr/local) at the same time. Stick to one at a time unless you are really sure of what you are doing.
-
Ned Deily over 13 years@EOL: not sure what you mean by Darwin packages. If you are referring to DarwinPorts, be aware that the information on the DarwinPorts website is basically an incorrect and unofficial ripoff of MacPorts and should be avoided. See here for more info: trac.macports.org/wiki/DarwinPortsFraud
-
Bruno Feroleto over 13 years@Ned: Oops! I meant "Fink". I have no idea why I wrote "Darwin" instead, besides the fact that it was about 2 AM. :)