Note: Jump to the end of this post to install a basic ipython-notebook environment.
ipython notebook is one of the most impressive things I’ve seen the last few years. You can reache outstanding results wich are documented and calculated on the same page. So no more paper war and mixed solutions for my problems anymore ;).
But while I get more and more different systems/computers and laptops, it’s hard to keep track of a consistent notebook. One could say: Use git or subversion. But then it comes to the point where you want to show some other guys your results in the bus and you want to change some variables, or add some new ideas (Assuming that you have internet everywhere nowadays). At that point even the notebook-viewer in combination with git becomes (more or less) futile.
So what do we want:
- An remote ipython notebook with up-to-date packages
- Secured from the rest of the world
- A secured write/execute-mode
- A read-only mode (so that we can distribute our achivements to privileged poeple)
- git (optional and not discussed here)
What do we have: A remote server running Debian, with a stable but non up-to-date repository.
While the points 2.-4. can be solved using this solution, the remote server becomes a problem, due to the fact that it has mostly a very stable but very outdated package repository. This leads to ugly outdated or non existing packages. In my case even the standard install routine from the ipython webpage did not work:
sudo apt-get install ipython-notebook python-matplotlib \
python-scipy python-pandas python-sympy python-nose
In this case, you have to use pip, which downloads the current packages from PyPI and compiles them for your system. As you can imagine, you need a bunch of dev packages. So here comes the solution at a glance:
# First we need some python and pip
apt-get install python python-pip
# Now lets install some necessary dependencies for installing with pip
apt-get install python-dev.all libfreetype6 libfreetype6-dev \
libpng12-dev gfortran libblas-dev liblapack-dev \
# Finaly, lets get the newest packages
pip install ipython
pip install matplotlib
pip install pyzmq
pip install jinja2
pip install scipy
pip install pandas
pip install sympy
pip install nose
pip install pygments # For html conversion
pip install sphinx # For latex conversion
ipython notebook # Running the notebook
A nice conversion from notebook to a PDF document:
ipython nbconvert MyNotebook.ipynb --SphinxTransformer.author="The Author" --to latex --post PDF
# Update [2014-04-15]
The new version of ipython was released: ipython 2.0.0 which needs python > 2.6. So you cannot use pip together with PyPi for installing/upgrading ipython 1.* anymore, if your system still runs python 2.6 or older.
The workaround is as follows:
Grep the newest 1.* release from the ipython archive
Then install the version (here 1.2.1) you need with pip explicitly:
pip install --upgrade http://archive.ipython.org/release/1.2.1/ipython-1.2.1.tar.gz