Difference between revisions of "Python Install libraries"

(Created page with 'Installing numpy, scipy, matplotlib and Basemap on Mac OS X can be challenging. == Installation using homebrew == This installation path should work for all versions of Mac OS …')
 
Line 3: Line 3:
 
== Installation using homebrew ==
 
== Installation using homebrew ==
  
This installation path should work for all versions of Mac OS X, because every library involved is self-compiled.  
+
This installation path should work for all versions of Mac OS X, because every library involved and the python interpreter is self-compiled. Make sure to use the system compiler to be compatible to system libraries.
 +
 
 +
 
 +
# Install [http://mxcl.github.com/homebrew/|homebrew] using the default settings.
 +
#: <code>ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"</code>
 +
# Install necessary libraries and python.
 +
#: <code>brew install gfortran python geos</code>
 +
# Install numpy via the python package manager pip which homebrew installed automatically with python.
 +
#: <code>pip install numpy</code>
 +
# Install scipy
 +
#: <code>pip install scipy</code>
 +
# Install matplotlib
 +
#: <code>pip install matplotlib</code>
 +
# Install ipython (not necessary, but recommended replacement for the standard python shell)
 +
#: <code>pip install ipython</code>
 +
# Install the python-imaging library, which is required for Basemap.
 +
#: <code>pip install PIL</code>
 +
# Basemap itself is unfortunately not available via pip, so you have to compile and install yourself. Download and extract the [http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/|source code from the sourceforge repository]. Then in the extracted directory run
 +
#: <code>python setup.py build</code>
 +
#: <code>python setup.py install</code>
 +
 
 +
== De-Installation ==
 +
 
 +
Follow the above commands in the opposite order and replace <code>install</code> by <code>uninstall</code>.
  
 
== Common pitfalls ==
 
== Common pitfalls ==
Line 11: Line 34:
 
*: to make sure to use the system compiler.
 
*: to make sure to use the system compiler.
 
* Do not mix pre-compiled and self-compiled libraries.
 
* Do not mix pre-compiled and self-compiled libraries.
 +
 +
[[Category:Python, IT]]

Revision as of 22:06, 24 January 2013

Installing numpy, scipy, matplotlib and Basemap on Mac OS X can be challenging.

Installation using homebrew

This installation path should work for all versions of Mac OS X, because every library involved and the python interpreter is self-compiled. Make sure to use the system compiler to be compatible to system libraries.


  1. Install [1] using the default settings.
    ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
  2. Install necessary libraries and python.
    brew install gfortran python geos
  3. Install numpy via the python package manager pip which homebrew installed automatically with python.
    pip install numpy
  4. Install scipy
    pip install scipy
  5. Install matplotlib
    pip install matplotlib
  6. Install ipython (not necessary, but recommended replacement for the standard python shell)
    pip install ipython
  7. Install the python-imaging library, which is required for Basemap.
    pip install PIL
  8. Basemap itself is unfortunately not available via pip, so you have to compile and install yourself. Download and extract the code from the sourceforge repository. Then in the extracted directory run
    python setup.py build
    python setup.py install

De-Installation

Follow the above commands in the opposite order and replace install by uninstall.

Common pitfalls

  • Make sure you have no other version of gcc installed. Check the output of
    which gcc
    to make sure to use the system compiler.
  • Do not mix pre-compiled and self-compiled libraries.