Using Ubuntu, here's how to install the entire NumPy / Scipy / Matplotlib / IPython / Pandas stack from Github to virtualenv using Python2.7:
Note. In the instructions below, install the latest development version of each package. If you want to install the latest tagged version, then after git clone check the tags available with
git tag
and select the version you want to install using
git checkout tag-name
sudo apt-get install python-virtualenv sudo pip install virtualenvwrapper
Make virtualenv
mkvirtualenv --system-site-packages dev workon dev # If you want to make this virtual environment your default Python, # edit ~/.bashrc to include workon dev
Add site packages to sys.path:
add2virtualenv $USER/.virtualenvs/dev/lib/python2.7/site-packages
pip install -U Cython
Install git
sudo apt-get install git
cd ~/src git clone https://github.com/numpy/numpy.git sudo apt-get install python-dev build-essential sudo apt-get install libatlas-base-dev libatlas3gf-base # ensure clean build # this is not necessary the first time, but useful when upgrading cd ~/src/numpy /bin/rm -rf ~/src/numpy/build cdsitepackages && /bin/rm -rf numpy numpy-*-py2.7.egg-info cd ~/src/numpy python setup.py build --fcompiler=gnu95 python setup.py install
cd ~/src git clone https://github.com/scipy/scipy.git # ensure clean build cd ~/src/scipy /bin/rm -rf ~/src/scipy/build cdsitepackages && /bin/rm -rf scipy scipy-*-py2.7.egg-info cd ~/src/scipy git clean -xdf python setup.py install
Install Matplotlib Dependencies
pip install -U pyparsing pip install -U six pip install -U python-dateutil pip install -U pytz sudo apt-get install libzmq-dev pip install -U tornado pygments pyzmq pip install -U nose sudo apt-get install python-qt4 python-qt4-doc python-pyside python-cairo python-wxgtk2.8 python-gtk2 dvipng apt-cache depends python-matplotlib | awk '/Depends:/{print $2}' | xargs dpkg
cd ~/src/ git clone https://github.com/matplotlib/matplotlib # ensure clean build cd ~/src/matplotlib /bin/rm -rf ~/src/matplotlib/build cdsitepackages && /bin/rm -rf matplotlib* mpl_toolkits
cd ~/src git clone https://github.com/ipython/ipython.git # ensure clean build cd ~/src/ipython /bin/rm -rf ~/src/ipython/build cdsitepackages && /bin/rm -rf ipython-*-py2.7.egg cd ~/src/ipython python setupegg.py install
cd ~/src git clone https://github.com/pydata/pandas.git cd ~/src/pandas # update git fetch origin git rebase --interactive origin/master
Update:
An advantage of the git approach is that it provides a way to always keep these packages updated:
cd ~/src/package-name git fetch origin git rebase --interactive origin/master
Follow the instructions above to ensure a clean build, and then rebuild and reinstall the package.
Shortcut for using pip with GitHub directly
The above steps for cloning and installing packages can be automated to the extent with pip. For example, we can also install NumPy as follows:
pip install git+git:
Updating will now be easy
pip install numpy
Flag
--force-reinstall may be needed because pip checks the version from PyPI and does not update if the current version is at least.