Adding a Python Environment to Open OnDemand JupyterLab

When to Use?

This guide is designed for those who need to set up a dedicated Python environment to manage project-specific dependencies without impacting the system-wide installation. Use it when you require a reproducible, isolated development setup in Open OnDemand JupyterLab or when troubleshooting environment issues.

Procedure

Step 1: Open a Terminal in JupyterLab

Step 2: Create and Activate a Virtual Environment

  • Create a new virtual environment using the venv module. Replace test_venv with a name of your choice. Run the following commands:
    • python -m venv test_venv
    • source test_venv/bin/activate
    • pip install ipykernel


       

Step 3: Register the Environment with Jupyter

  • Once the virtual environment is set up and activated, register it with Jupyter using the command below. You can change "myvenv" to a name that better identifies your environment:​​​​​​​
    • ​​​​​​​python -m ipykernel install --user --name "myvenv"​​​​​​​


       

Final Note:

  • After completing these steps, you can select your newly created environment from the JupyterLab launcher, and it will operate as an independent Python kernel

           
    ​​​​​​​
     
Was this helpful?
0 reviews