Skip to content

Extending environment with pip

You may want to install a Python library that is not installed by default on the VRE. If you think that the library can be useful for all users of the platform, please ask for a global installation. But you can still install libraries on your own environment.

2 ways of doing this are available. In both cases, the proxy environment variables should be set.

Using user environment

With user pip option, you can install a library on your user space.

pip install --user requests

The lib will be installed in $HOME/.local/lib/python3.6/site-packages.

Working from a jupyter notebook, run:

%pip install emoji

See https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-pip.

Then restart the kernel and you can execute:

import emoji

Using a virtual environment

The alternative is to create a virtual environment. This way you will be able to install several versions of the same lib.

virtualenv venv
source venv/bin/activate
pip install requests==2.23.0

Use a virtual environment as a notebook kernel

virtualenv venv
source venv/bin/activate
python -m ipykernel install --user --name testenv --display-name "Test env (testenv)" 

Then a new kernel will be available in the launcher tab (reopen launcher if missing).

After that jupyter kernelspec list allows to list available kernels and jupyter kernelspec uninstall testenv can be used to remove the kernel if needed before removing the conda virtual environment itself.

Using conda

See conda page for more insight on how to use conda into the VRE.