SciPy is the scientific Python library and is closely related to NumPy. In fact, SciPy and NumPy used to be one and the same project many years ago. In this recipe, we will install SciPy.
In Chapter 1, Winding Along with IPython, we discussed how to install setup tools and pip. Reread the recipe if necessary.
In this recipe, we will go through the steps for installing SciPy.
git clone https://github.com/scipy/scipy.git python setup.py build python setup.py install --user
This installs to your home directory and requires Python 2.6 or higher.
Before building, you will also need to install the following packages on which SciPy depends:
There is a chance that you have already installed this software as a part of the NumPy installation.
yum install python-scipy
urpmi python-scipy
sudo emerge scipy
sudo apt-get install python-scipy
You probably already have a Fortran compiler installed for NumPy. The binaries for gfortran
can be found at http://r.research.att.com/tools/.
sudo pip install scipy easy_install scipy
import scipy print scipy.__version__ print scipy.__file__
This should print the correct SciPy version.
Most package managers will take care of any dependencies for you. However, in some cases, you will need to install them manually. Unfortunately, this is beyond the scope of this book. If you run into problems, you can ask for help at: