Frequently Asked Question

How can I have a workspace with specific versions of Python packages?
Last Updated 3 years ago

You can use virtual environments to install specific versions of packages and install a custom Jupyter kernel to use them in your interactive notebooks.

  1. Open a terminal from the launcher.
  2. Go to the directory where you want to store your virtual environment.
    cd the/directory/you/want
  3. Create the virtual environment (change myenv with the name you want).
    python -m venv myenv --system-site-packages
    The --system-site-packages flag allows the packages installed on the platform to remain accessible in the virtual environment. If you want a clean environment do not use this flag.

  4. Activate the virtual environment.
    source myenv/bin/activate
  5. Register the virtual environment with JupyterLab.
    python -m ipykernel install --user --name=myenv
    The virtual environment will be listed in the launcher and kernels list once you log out and log in again.

  6. Install packages you want.
    pip install package==version
    pip install package==version
  7. Exit the virtual environment.
    deactivate
  8. If you need to install additional packages later, activate the virtual environment and install packages as indicated above.
  9. You can un-register the virtual environment at any time.
    jupyter kernelspec uninstall myenv
  10. You can remove the virtual environment by removing its directory.
    rm -rf myenv
  11. Some packages may require system-wide libraries to be available. If you encounter any errors while installing packages please contact us.

Further Reading:

Please Wait!

Please wait... it will take a second!