Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
en:services:application_services:jupyter:start [2019/10/07 15:02]
bwegman1 [Installing large python modules and disk space]
en:services:application_services:jupyter:start [2019/10/07 15:24]
bwegman1 [Notebook fails to start after package installation or update, error 500]
Line 59: Line 59:
 </​code>​ </​code>​
 This deactivates all additionally installed packages. The notebook should start again normally. This deactivates all additionally installed packages. The notebook should start again normally.
 +
 +==== Installation of additional packages and environments via Conda ====
 +
 +Management of software packages and environments with Conda requires a terminal session started from the notebook server. The terminal ist available after login via ''​New -> Terminal''​.
 +
 +Before working with ''​conda''​ commands the necessary conda functions need to be loaded (<​b>​mind the dot at the beginning!</​b>​):​
 +<code bash>
 +. /​opt/​conda/​etc/​profile.d/​conda.sh
 +</​code>​
 +
 +=== Creating a new environment ===
 +
 +The following describes the creation of a new, simple environment ''​wikidoku'',​ the installation of the package ''​jinja2''​ as an example and how to make the environment available in the kernel selection of the notebook.
 +
 +Creating and activating the environment:​
 +<code bash>
 +conda create -y --prefix ./wikidoku
 +conda activate ./wikidoku
 +</​code>​
 +
 +Next the new environment will be registered with the notebook. Terms for ''​--name''​ and ''​--display-name''​ can be chosen freely, the later being shown in the kernel selection of the notebook. The second command lists all known environments.
 +<code bash>
 +python -m ipykernel install --user --name wikidoku --display-name "​Python (wikidoku)"​
 +jupyter kernelspec list
 +</​code>​
 +
 +If installation of the kernel fails with the message ''/​usr/​bin/​python:​ No module named ipykernel''​ the additional package ''​jupyter''​ needs to be installed and installation of the kernel repeated:
 +<code bash>
 +python -m pip install jupyter
 +</​code>​
 +
 +As an example the package ''​jinja2''​ will be installed next. This is the step to install the desired software packages from various Conda channels. The last command exists the environment.
 +<code bash>
 +conda install -y jinja2
 +conda deactivate
 +</​code>​
 +
 +=== Selecting the new environment ===
 +
 +== Restarting of the notebook server ==
 +
 +After installation of a new environment it is recommended to restart the notebook server. Leave all existing terminals and close all open notebooks. In the Jupyter overview page click on ''​Control Panel''​ and stop the server by clicking ''​Stop My Server''​ and restart it with ''​Start My Server''​.
 +
 +Via ''​New ->''​ a new notebook with the new environment can be started. In existing notebooks the kernel can be changed after starting the notebook and selecting ''​Kernel -> Change Kernel''​.
 +
 +=== Installing additional kernels in an Conda environment ===
 +
 +Installing a new, independent Python kernel für the current environment is possible. As an example an older Python 2.7 kernel will be installed next.
 +
 +A new environment needs to be created and activated as per the steps above.
 +Next follows the installation of the kernel, the ''​jupyter''​ module for that kernel and finally the kernel is made available for selection in the kernel list.
 +<code bash>
 +conda install -y python=2.7
 +python -m pip install jupyter
 +python -m ipykernel install --user --name oldpython --display-name "​Python 2.7 (oldpython)"​
 +</​code>​
 +
 +The new kernel is now available for new and existing notebooks after restarting the notebook server.
 +The current kernel version can be queried from within Python:
 +<code python>
 +import sys
 +print (sys.version)
 +</​code>​
 +
 ==== Installing additional R packages==== ==== Installing additional R packages====
 <​code>​ <​code>​