Difference: JupyterROOTContainers (8 vs. 9)

Revision 92021-09-12 - WilliamSeligman

Line: 1 to 1
 
META TOPICPARENT name="IPython"

Jupyter/ROOT Containers

Line: 12 to 12
 
  • Folks who'd like to go through the ROOT tutorial but who don't have computer accounts with a Nevis particle-physics group.
Added:
>
>

Anaconda

Anaconda is a software manager that allows you download and execute packages in your home directory.

If you use the Nevis Linux cluster, then you should consider using environment modules over Anaconda, if for no other reason than to save disk space (see below). But if you're on a different system, or the Nevis environment modules don't offer the package or version you're looking for, Anaconda is a better choice. All the Nevis Linux cluster systems running CentOS 7 have conda installed.

If you're not at Nevis, you can also separately install Anaconda.

Once you've installed Anaconda, youíll probably have to include conda-forge. The following commands set it up:

conda config --add channels conda-forge
conda config --set channel_priority strict

To install Jupyter/ROOT:

conda create --name jupyter-pyroot jupyter python root

Note that the name jupyter-pyroot is arbitrary; you can use any name for the conda environment that you wish.

There are additional standard packages that youíll probably want to include in your conda environment (note that conda install adds more packages to an environment you've already created):

conda install --name jupyter-pyroot jupyterlab numpy scipy matplotlib 

Your working group may use additional packages. For example, the VERITAS group at Nevis might want to use (in addition to the above):

conda install --name jupyter-pyroot astropy gammapy 

You only have to go through the above steps once to define an environment (e.g., jupyter-pyroot). Afterwards, once per login session, itís necessary to activate it:

conda activate jupyter-pyroot

Once activated, you should be able to run ROOT by simply typing:

root

You can run jupyter with:

jupyter notebook
or to enable remote access (read all the instructions at the bottom of the Jupyter page):
jupyter notebook --no-browser --port=XXXX

Warnings

  • If youíre installing packages that have been pre-compiled by the maintainers of conda and conda-forge, then this process usually works well. However, if youíre using a system that does not have a pre-compiled version, conda will compile them on your computer. Not only can this take some time, but the results can be unreliable; Iíve seen a computer pause for many hours to re-compile ROOT only to finish with a program that issued errors every time I tried to run it.
  • A conda environment can take up a lot of disk space, since it not only installs the packages you list, but any other packages that they depend on. On my desktop computer, the minimal Jupyter/ROOT container described above takes up 3G. This may not seem like much, but summer students at Nevis have a disk quota of 10G. Itís possible to run into disk-space problems, especially if youíre sharing disk space with other users, if you add more packages to your environment, or begin to define multiple environments for different projects.
  • Anaconda changes your shellís execution environment. It may be incompatible with other environment setups (such as MicroBooNEís LArSoft, ATLASí Athena, or Nevisí module load command).
  • Your shellís prompt will be changed by conda. Even when youíre not using conda, the text (base) will appear at the beginning of the prompt. If this doesnít bother you, then ignore it. If it does, you can try:
    conda config --set auto_activate_base false
    
    Youíll have to log off then log in again to see the change. If you donít want conda to alter your prompt even when youíre using an environment, this command will suppress condaís prompt changes:
    conda config --set changeps1 False
    
 

Docker

Changed:
<
<
Docker is probably the best method of running Jupyter+pyroot with a minimum of fuss. Its disadvantage is that it requires administrative access to the host computer system (e.g., your laptop), both to install Docker and to run the Docker container.
>
>
While Anaconda is an environment-level container, Docker (and Singularity below) are OS-level containers. Docker is probably the best method of running Jupyter+pyroot without having to worry about issues like package compilation. Its disadvantage is that it requires administrative access to the host computer system (e.g., your laptop), both to install Docker and to run the Docker container.
  The first step is to install Docker. For Mac and Windows systems, use Docker Desktop; there's a different procedure needed for Linux systems.
Line: 132 to 203
  Note that while you can change the mapping of the /work directory within the container (see above), you can't change Jupyter's binding to port 8080. This might be a problem if you're running on a shared computer system and more than one user wants to run this container at the same time.
Deleted:
<
<

Anaconda

Docker and Singularity are OS-level containers (in contrast to emulators like VMware, which are machine-level containers). Anaconda is an environment-level container; it doesn't change the operating system, but it allows you download and execute packages in your home directory.

If you use the Nevis Linux cluster, then you should consider using environment modules over Anaconda. But if you're on a different system, or the Nevis environment modules don't offer the package or version you're looking for, Anaconda is a better choice. All the Nevis Linux cluster systems running CentOS 7 have conda installed. You can also separately install Anaconda in your home directory if you wish.

To install Jupyter/ROOT via conda, this command is supposed to work:

conda create --name jupyter-pyroot jupyter python root

However, I've found this method to be unreliable. Typically there's no problem with jupyter or python, but installing ROOT via Anaconda is hit-or-miss.

Assuming you succeed, you can run the jupyter command as described near the bottom of the notebook server page; e.g.,:

jupyter notebook
or to enable remote access (again, read all the instructions at the bottom of the Jupyter page):
jupyter notebook --no-browser --port=XXXX
 

The hard way

If all other methods fail, you can embark on the adventure of compiling these packages on your own. You can install Python, ROOT, and Jupyter on your laptop. In fact, Jupyter is meant to be a laptop tool; the container installations described above are to save you time. If you want to try your own installation:

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback