You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Current »

A number of workstations have jupyter servers running on them. For the uninitiated, Jupyter is a service for interactive computing in three core languages: Julia, python, and R. It behaves like an interactive notebook, so you can develop code and generate plots with great ease.

The notebook servers are running on two of our local machines, top1 and gpu1. To begin, go to https://top1.hep.utexas.edu or https://gpu1.hep.utexas.edu in your browser. Use your UT HEP account credentials to log in. You can begin by creating a notebook. At that point, you can just enter python commands and start coding!

Useful tips:

  1. Suppose you want to save your notebook in a location other than your home directory (e.g. on /code). This can be done by making a soft link from your top1/gpu1 home directory. In a terminal, type the following
    $ ln -s /code/username/ ~/code
  2. Suppose you want to use your own anaconda environment to run the notebook. The instructions to do so come from here. Again, in the terminal,
    $ conda create --name myenv python=3.7
    $ source activate myenv
    $ conda install jupyter
    $ python -m ipykernel install --user --name python_custom --display-name "My Python"
    You'll then be able to choose your environment from the new notebook tab, or change the kernel from within a notebook.
  3. There are a lot of keyboard shortcuts in jupyter. To enter command mode, press esc. Then type the jupyter command.
  4. Cells do support markdown formatting, so you can insert LaTeX equations into your notebooks.
  5. Version control can be used with jupyter notebooks. I store all of my notebooks in a git-watched directory. However, I usually clear all cell outputs before committing to git, to avoid committing lots of garbage image data in the .ipynb files and cluttering up the git record.
  6. Do you want a package that isn't installed? Is one of your packages out of date? If it's a typical package, you can ask Peter to install it on the default kernel. Otherwise, setup your own anaconda environment and install it yourself. Follow the instructions in tip #2.
  7. Keep in mind that kernel instances are opened in the default environment where the JupyterHub server was started, i.e. whatever environment Peter happened using when he started the server. So you will not be able to access the environment variables of your custom anaconda environment with os.environ['PATH'] or os.getenv('PATH'), as you would be able to do if you were running a jupyter notebook on your own server. Anyway, this can be fixed by printing out the environment variable you want in a terminal window with the appropriate environment activated, and pasting it into python.
    $ source activate myenv

    $ echo $PATH
    Then, in your jupyter notebook,
    In [1]: os.environ['PATH'] = ...


Please feel free to ask Chuck if you have any questions!

  • No labels