Basic Python packages for scientific computing include numpy
,
sympy
, matplotlib
, scipy
, ipython
, nose
, and odespy
.
Some of these packages depend on a series of non-Python software
packages that must be installed on the system. These and other relevant
Debian packages are
gcc g++ gfortran
libatlas-base-dev libsuitesparse-dev
tcl8.5-dev tk8.5-dev
subversion mercurial cvs git gitk
libfreetype6-dev libpng-dev
mayavi2 tcl-vtk
libsqlite3-dev
With this software in place, we can go on with pip install
of Python packages:
Terminal> packages="numpy sympy matplotlib scipy ipython nose"
Terminal> for p in packages; do pip install $p; done
Terminal> pip install -e \
git+https://github.com/hplgit/odespy.git#egg=odespy
Note that pip install
is preferred over apt-get install
of Debian
packages because pip
will usually install a newer version of the
package. It also opens up the possibility for installing the
development version directly from the package's
repository on (e.g.) GitHub.
A pip freeze > requirements.txt
results as usual in a list of
the packages in the environment, but this file is not so useful.
numpy
must be installed before scipy
, matplotlib
, and most other
packages for numerical computing. One must therefore provide
a Bash script or Python program for installing the environment.
Virtualenv is still useful for having multiple environments with
different versions of, e.g., numpy
and matplotlib
, but pip install
via a requirements.txt
file is not possible.
A Bash script for installing the environment above may look like
#!/bin/sh
apt="yes | sudo apt-get install"
$apt gcc g++ gfortran
$apt libatlas-base-dev libsuitesparse-dev
$apt tcl8.5-dev tk8.5-dev
$apt subversion mercurial cvs git gitk
$apt libfreetype6-dev libpng-dev
$apt mayavi2 tcl-vtk
$apt libsqlite3-dev
packages="numpy sympy matplotlib scipy ipython nose"
for p in packages; do pip install $p; done
pip install -e git+https://github.com/hplgit/odespy.git#egg=odespy
Other packages can be added to the script as well:
pip install -e git+https://github.com/hplgit/scitools.git#egg=scitools
# Do manual install of Scientific Python
if [ ! -d srclib ]; then mkdir scrlib; fi
cd srclib
hg clone https://bitbucket.org/khinsen/scientificpython
cd scientificpython
sudo python setup.py install
cd ../..
(hpl 1: Should refer to the Vagrant document for how to make a list of packages and then autogenerate scripts.)
References.