Setting up numpy, matplotlib, wxPython, ipython, etc.
I found dealing with virtual environments just too annoying (see below). I opted to reinstall ubuntu 12.04 fresh, and start the process over with no virtual environments. First thing, I ran update manager (click the icon at the top of the dock and type 'update manager.' To add the terminal to the dock, type 'terminal' and drag the icon to the dock, this is where we will type the following commands.) After all the updates, I restarted.
In a terminal, I typed:
sudo apt-get update
sudo apt-get install python-numpy
(This resulted in installing 1.6.1, which I am not thrilled about, since 1.6.2 is already out.)
sudo apt-get install python-scipy
sudo apt-get install python-matplotlib
sudo apt-get install python-wxtools
sudo apt-get install ipython
testing ipython, numpy, and pylab (matplotlib):
import numpy as np
Wow, that was a lot easier than virtualenv.
apt-cache show ipythonto show package information about ipython (or any other package)
apt-cache depends ipythonto show what packages ipython depends on.
apt-cache search ipythonto search available packages for 'ipython'
Since I'm on a roll, I decided to install two new fancy tools that look cool:
sudo apt-get install ipython-qtconsole
sudo apt-get install ipython-notebook
Both of them work, and ipython notebook looks dope!
I've decided to keep python packages compartmentalized from the system installation by using virtualenv, so my first step will be to install it (instructions at http://www.virtualenv.org/en/latest/index.html). I'm going to use pip to download and install python packages inside the virtual environment, so I'll use easy_install to set up my virtualenv. This way, any pip installation I have should only reside inside a particular virtualenv (not sure this is true, but worth a try...)
OLD: My first attempt, using virtualenv
Setting up a virtual environment
sudo apt-get install python-setuptools
Now I'll install virtualenv:
sudo easy_install virtualenv
OK, that appears to have worked.
virtualenv --no-site-packages firstEnv
It turns out that the
--no-site-packagesis deprecated, since this is now the default behavior, but it doesn't seem to have done any harm.
Now, to activate the virtualEnv, type
source firstEnv/bin/activate. Typing
pipnow shows that it is installed. If I type
deactivate, then type
pip, we see that pip is only installed in the virtual environment, sweet!
Installing numpy in the virtual environmentLet's get down to the business of installing some packages in our virtual environment:
pip install numpy
Error! Looks like I first have to install python-dev:
sudo apt-get install python-devtrying to install numpy again:
pip install numpyworks!
Installing matplotlib in the virtual environmentNext let's install matplotlib. It has some non-python dependencies, so we'll install these with apt-get:
sudo apt-get update
sudo apt-get install libpng-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install libjpeg8-dev
sudo apt-get install g++
To be honest, I'm not sure if all of these are necessary, but the last one (g++) definitely is. Supposedly there can be problems if gcc and g++ are not the same version, which you can check by typing
Finally, we are ready to get matplotlib:
pip install matplotlib
So that is ready to go.
Installing ipython in the virtual environmentFinal step, let's get ipython working.
sudo apt-get install libzmq-dev(this probably installs more than we need, installation took a LONG time.)
pip install pyzmq
pip install ipython[zmq,qtconsole,notebook,test]
sudo apt-get install libqt4-*
Download SIP and PyQt from http://www.riverbankcomputing.co.uk/software/sip/download and http://www.riverbankcomputing.co.uk/software/pyqt/download.
sudo make install
sudo make install
at this point ipython, ipython qtconsole, and ipython notebook all seem to be working, but no windows show up for pylab plotting.
sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n
But now wx is installed outside of virtual environment... Instead I will try to build it from source:
download the development (2.9) version wxPython-src from http://wxpython.org/download.php#stable
Following these instructions (http://wxpython.org/BUILD.html I did this:
sudo apt-get install gtk+3
sudo apt-get install gstreamer0.10
This takes a LONG time
python build-wxpython.py --install --build_dir=~/src/wx --installdir=~/src/wx --wxpy_installdir=~/src/wx THIS DID NOT WORK.
This link contains some info to get it working: http://codersbuffet.blogspot.com/2009/09/wxpython-in-virtualenv.html
might try it later...
Or possibly something like this: