Configuring and customizing Jupyter

Your .jhubrc file

Before a notebook server is launched, some modules get loaded by default. In addition to these default modules, you can load your own modules, and export custom environment variables in a file called .jhubrc in your home directory. All commands in the .jhubrc are executed before your notebook server is launched.

For example, to create a notebook using the MATLAB kernel, you will need the following lines in your .jhubrc:

module load matlab/2015a zeromq/4.1.5

Note that the only commands that will have any effect are module and export commands. The .jhubrc affects only the kernel environments (i.e., the environments of your notebooks), and not the terminal environment. The terminal environment can be customized using .bashrc or .bash_profile.

Installing additional Python/R packages

The default Jupyter environment supports Python and R kernels which are pre-loaded with several common packages for scientific computing and data analysis. It's also easy to install your own packages/libraries for use with these kernels.

We recommend using either pip or Conda to install Python packages whenever possible. You can install most Python package using the terminal with the following commands:

$ module add anaconda3/2.5.0
$ pip install <package_name> --user

This will make the package available to the Python 3 kernels.

For R packages, you can define the R_LIBS environment variable in your .jhubrc to specify where libraries get installed and loaded by notebooks.

Adding new kernels

In addition to the default kernels provided (Python, R, and MATLAB), it is possible to create your own kernels. To install kernels for other languages, see the setup instructions for the language here.

For custom Python kernels, we recommend using Conda environments, and ipykernel to generate a kernel from a Conda environment:

$ conda create --name myenv python=2.7
$ source activate myenv
$ conda install jupyter
$ python -m ipykernel install --user --name python_custom --display-name "My Python"

See the Conda documentation for more details about Conda environments.