I’ve got a spanking new install of Kubuntu 11.10, and I need to get it set up for Python data hacking. Sure, I could spring for an Enthought Python Distrubution, but where would be the masochism in that?
Inspired by Zed, let’s do this the hard way.
The linux distro comes with Python 2.7.2. Perfect! Or, use Pythonbrew to set up a local Python build that you want to use. I presume you know how to get to the command line, as well as how to edit text files using emacs, vim, pico, whatever.
Let’s get some tools:
We need to compile against Python headers and get setuptools and pip:
Let’s isolate our Python distro from carnage:
sudo pip install virtualenvwrapper
Now these lines to your ~/.bashrc:
Now open a new terminal and establish a virtual environment, say “py27”:
We need some math libraries (ATLAS + LAPACK):
Ok, now to install and build all the scientific python hotness:
For matplotlib, we need lots of libraries. This one is dependency heavy. Note we can ask Ubuntu what we need, what’s installed, and what is not:
Easiest thing to do is just build all the dependencies (just say yes if it asks to install deps of matplotlib instead of python-matplotlib):
Ok, now this should work:
Now, of course, we need the IPython interpreter. Don’t settle for 0.11!
python setupegg.py install
Note, you may need to sudo rm /usr/bin/ipython.py if there is a conflict.
Ok, let’s beef up the IPython interpreter. Note the pip commands FAIL. This is ok. We’ll do it by hand.
pip install sip
sudo make install
pip install pyqt
sudo make install
# clean up
rm -rf build
Just a few more things, you won’t be disappointed.
pip install tornado pygments pyzmq
pip install -e git+https://github.com/wesm/pandas#egg=pandas
# we should get statsmodels too
pip install -e git+https://github.com/statsmodels/statsmodels#egg=statsmodels
Btw, you’ll note this git stuff goes into your ~/.virtualenvs/py27/src directory, if you want to git pull and update.
OK! Phew! For the grand finale:
Run the amazing qtconsole:
Or the even more amazing WEB BROWSER:
Launch a browser and point to http://localhost:8888/. For kicks, try opening one of Wes’s tutorial workbooks, here. You may have to fiddle a bit, but it should work.