How to install numpy and scipy on OS X?

Hey guys, I'm new to Mac, so please carry me.

I am using the 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 my official site. However, I have problems with import import:

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 on this issue? >

+6
source share
8 answers

It sounds as if you can use the 32-bit library from 64-bit Python. There seems to be an unofficial 64-bit Numpy available for Snow Leopard .


EDIT: Python 2.6.dmg is available here really 32-bit. (In particular, it is a universal binary file containing versions of i386 and ppc). The same can be said for the standard numpy and scipy.dmg releases available here . (How do I know? See below!) So, if you use these releases together, you should be fine.

But you are not fine - therefore I assume that you are not using the Python version from 2.6.dmg you downloaded. If you are using an executable python script, for example:

 $ ./my-script.py 

then you can try specifying Python that you explicitly use on the command line. It looks like MacPython.dmg is installed in / usr / local / bin / python, so try:

 $ /usr/local/bin/python2.6 myscript.py 

Any joy?


As I defined the architecture, the contents of these .dmg files are built for ...

  • Install .dmg (i.e. double click it to open volumes)
  • Use gunzip and pax to unpack the contents of the package into a local directory, for example:

     $ 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 view binary files in 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 
+8
source

I had the same error message when I tried to install the newly installed new product 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 a package in 10.3.dmg giving me the multiarray.so error message. After installing version 10.6.dmg, I got rid of this error message.

+7
source

I had problems with numpy, until I installed in virtualenv, now I have no problems. I definitely suggest trying this.

+2
source

for the 64-bit snow leopard I used the following person http://blog.hyperjeff.net/?p=160 just follow and you will go well. Also see comments (new AMD ...)

The numpy building is working all the time. but for scipy you need to provide numpy configuration files. install gfortran .....

+1
source

The best way to manage packages on OS X is Fink (not MacPorts :)). They have good support for Python, NumPy, and SciPy.

Why use a package manager? because you will not only get NumPy and SciPy, but also many other programs that you will inevitably need, and all with one entry point (basically the manager installation command). This is much more convenient than hunting for certain compiled versions of the programs you want to install.

Why fink? because Fink is reputedly more stable than MacPorts and has a lot more packages.

0
source

No need to use MacPorts or Fink.

Use the Python 2.6 installer and this Numpy installer . I think you need to install Numpy first and then install Scipy , and everything will work automatically. I remember that for some time I needed to explicitly add the path to the package sites directory at the top of my Python scripts to find out where to look.

0
source

In case this is useful to someone, I also had problems installing numpy binaries on OSX. The installer complained that he said:

You cannot install numpy 1.5.1 on this volume. numpy requires installing System Python 2.6.

In short: “System Python” means “python from python.org ” and “2.6” really means 2.6, not 2.5, not 2.7. So go ahead and find the installer for the python version that numpy wants, and then everything is fine.

In my first attempt, I realized the numpy error, indicating that I have an outdated python, so I got the latest version (2.7 at the time), but numpy complained anyway. Only after a thorough reading of the message did I realize that he really needed 2.6, and not any other version. I destroyed the first installation (found in /Library/Frameworks/Python.framework ) and installed 2.6 after that. Finally numpy was happy to install, and everything was in order.

0
source

I spent countless hours browsing the web trying to get various python packages running on OS X. In the end, I found that the easiest solution was to either completely switch to Ubuntu or run Ubuntu in Virtualbox from OS X (all for free )

Using Ubuntu's package manager, apt-get, almost any package you want will work out of the box after one simple install command. It was a huge rush when I first earned a few minutes, scipy and matplotlib.

 $ sudo apt-get install python-numpy python-scipy python-matplotlib 

I still get a mini tide every time I do this. Not sure if there is a debian package for the module you want? Typically, there is and you can search, say, a python lxml module with:

 $ apt-cache search lxml | grep python 
0
source

All Articles