I’m currently reading the book Python for data analysis and I have struggled to setup a remote IPython notebook server with all the scientific python stack, in a virtualenv, on Ubuntu Server. That’s why I share the steps I followed to get everything running, without the headhaches.
This guide will show you how to setup a remote IPython notebook server with the following features:
- a full featured remote Python REPL
- everything installed in a virtualenv
- password protected
- inline charts (thanks to Matplotlib)
And we will install the following libraries: Numpy, Scipy, Pandas and Matplotlib.
I assume you have working virtualenvs.
pylab is the combination of NumPy, Matplotlib, and IPython, so when you start IPython in pylab mode, all these module are already imported.
The only way to run IPython in pylab mode on a remote server is to run the IPython notebook server, you also need to install a backend to generate the chart, I choose to use python-qt4.
First we need to install some dependencies.
Then, in your virtualenv:
We need to get pyqt4 installed in the virtualenv, since it doesn’t works with pip, I found a gist that do the job:
I found this gist to get pyqt4 working inside a virtualenv.
With the target virtualenv activated.
1 2 3
And finally, you need to add that line in ~/.matplotlib/matplotlibrc.
Configuring the notebook server
You should check out the IPython notebook docs.
First, get your password hashed with IPython utility.
1 2 3 4
Next, create a new IPython configuration profile.
1 2 3 4 5 6 7
Running the server
Now, you can run the server, to keep it running, you can manage the process with Supervisor.
To check if inline chart works, just type that line in new notebook:
That’s it, now you are able to access your notebook from everywhere.
And you ?
Don’t hesitate if you have any questions or tips !