Thanks to Ian’s previous post, I was able to set up IPython notebook on Della, and I’ve been working extensively with it. However, when I was trying to sync the notebooks between the copies on my local machine and Della, I found out that the version of IPython on Della is the old 2.3 version, and that IPython is not backward compatible. So any IPython notebook that I create and work on in my local directory will simply not work in Della, which is quite annoying.
Also, I think there is a lot of benefit to setting up and using Anaconda in my Della directory. It sets up a lot of packages (including Python 3, instead of the archaic 2.6 that Della runs; you have to module load python as Ian does in his post in order to load 2.7) and manages them seamlessly, without having to worry about what package is in what directory.
According to the Conda website:
Conda is an open source package management system and environment management system for installing multiple versions of software packages and their dependencies and switching easily between them. It works on Linux, OS X and Windows, and was created for Python programs but can package and distribute any software.
So, let’s get started. First, go to:
And download the latest Linux x86-64 version, namely:
Then, scp the Miniconda installer to your Della local directory (e.g. /home/my.user.name/)
Note: I initially tried using the easy_install way of installing conda, only to run into the following error:
Error: This installation of conda is not initialized. Use 'conda create -n
envname' to create a conda environment and 'source activate envname' to
# Note that pip installing conda is not the recommended way for setting up your
# system. The recommended way for setting up a conda system is by installing
# Miniconda, see: http://repo.continuum.io/miniconda/index.html
It indeed is preferable to follow their instructions. Then run:
And follow their instructions. Conda will install a set of basic packages (including python 3.5, conda, openssl, pip, setuptools, only to name a few useful packages) under the package you specify, or the default directory:
It also modifies the PATH for you so that you don’t have to worry about that yourself. How nice of them. (But sometimes you might need to specify the default versions of programs that are on della, especially for distributing jobs to other users, etc. Don’t forget to specify them when needed. But you should be set for most use cases.)
Now, since we are using the conda package version of pip, by simply running,
pip install ipython
pip install jupyter
conda install ipython
conda install jupyter
conda will integrate these packages into your environment. Neat.
That’s it! You can double check what packages you have by running:
After this, the steps for having the notebook serve the notebook to your local browser is identical to the previous post. Namely:
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
mv mycert.pem ~/local/lib/
ipython profile create profilename
from IPython.lib import passwd
c.NotebookApp.port = 1999 # change this port number to something not in use, I used 2999
c.NotebookApp.password = 'sha1:…' #use generated pass here
c.NotebookApp.certfile = u'/home/my.della.user.name/local/lib/mycert.pem'
c.NotebookApp.open_browser = False
c.NotebookApp.ip = '127.0.0.1'
ssh -A -L<Your Port #>:127.0.0.1:<Your Port #> email@example.com
ipython notebook --ip=127.0.0.1 --profile=profilename --port <Your Port #>
# note that if you are trying to access Della
# from outside the Princeton CS department, you
# may have to forward the same port from your home computer
# to some princeton server, then again to Della
# In your browser go to
http://127.0.0.1:<Your Port #>
After you’ve set everything up, you can upload the ipython notebook to gist for sharing with others. I’ll repeat the post:upload-a-gist-to-github-directly-from-della for convenience:
# First, install gist gem locally at della
gem install –user-install gist
echo ‘export PATH=$PATH:/PATH/TO/HOME/.gem/ruby/1.8/bin/’ >> ~/.bashrc
# Boot up connection
[Enter Github username and password]
# Upload gist, e.g.
gist my_notebook.ipynb -u [secret_gist_string]
# secret_gist_string is the string already associated with a particular file on Github
# To obtain it, the first time you upload a file to Github (e.g. my_notebook.ipynb) go to
# https://github.com/ | Gist | Add file [upload file] | Create secret Gist, which will
# return a secret_gist_string on the panel at right (labeled “HTTPS”)
Here is an example ipython notebook that I shared through gist and is available for viewing: