Category Archives: python

Installing IPython notebook on della computing cluster

# Create local python site-packages folders

mkdir /home/my.della.user.name/local/
mkdir /home/my.della.user.name/local/lib/
mkdir /home/my.della.user.name/local/lib/python2.7/
mkdir /home/my.della.user.name/local/lib/python2.7/site-packages/

# tell python where to find these packages

echo 'export PYTHONPATH=$HOME/local/lib/python2.7/site-packages' >> ~/.bashrc
source ~/.bashrc

#python 2.7 is not default at della

module load python

# install packages needed for running the notebook

python -measy_install --prefix /home/my.della.user.name/local tornado
python -measy_install --prefix /home/my.della.user.name/local pyzmq
python -measy_install --prefix /home/my.della.user.name/local jinja2

echo 'export PATH=$HOME/local/lib/python2.6/site-packages:$PATH' >> ~/.bashrc
source ~/.bashrc

#create mycert.pem using the following openssl cmd:

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

# my mycert.pem wherever you’d like

mv mycert.pem ~/local/lib/

# create an ipython profilename

ipython profile create profilename

# generate a password using the following ipython utility:

python
from IPython.lib import passwd
passwd()
Enter password:
Verify password:
'sha1:…'

#copy this hashed pass

vi /home/my.della.user.name/.ipython/profile_profilename/ipython_config.py

# edit:

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'

[save]

 

# sign off and sign back on to della

ssh -A -L<Your Port #>:127.0.0.1:<Your Port #> my.della.user.name@della.princeton.edu
module load python

# boot up notebook

ipython notebook --ip=127.0.0.1 --pylab=inline  --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 #>