Using Python or Conda environments in the Jupyter App
We recommend all users to install Python packages within an environment. This can be a Conda to a python virtual environment. More information can be found here. Follow these steps to use such environments in the Jupyter app.
Python Environments:
One Time Setup:
Open a terminal on Oscar.
Load the relevant python module and create and/or activate the environment. See this page for more information about creating virtual environments.
Run
pip install notebook
to install Jupyter notebook, if not already installed.Run
pip install ipykernel
to install ipykernel in this environment.Run
python -m ipykernel install --user --name=<myenv>
where<myenv>
is the name of the environment.
Launching Jupyter Notebook
Open the "Basic Jupyter Notebook for Python Environments" app on the Open OnDemand interface
Under "Python Module on Oscar", choose the python module you loaded when the environment was created.
Under "Python Virtual Environment", add the name of the Virtual Environment you created. Note: If your virtual environment is not at the top level of your home directory, you should input the absolute path to the environment directory.
Under the "Modules" , enter the name of the python module used to create the environment. Add any additional modules you may need separated with a space.
Choose the other options as required.
Click "Launch" to start the job
Click "Connect to Jupyter" on the next screen.
To start a new notebook, click "New" -> <myenv> where <myenv> is the environment.
For starting a pre-existing notebook, open the notebook. In the Jupyter interface, click "Kernel" -> "Change Kernel" -> <myenv> where myenv is the name of the environment.
Conda Environments
One Time Setup:
Open a terminal on Oscar.
Activate the conda environment.
Run
pip install notebook
to install Jupyter notebook, if not already installed.Run
pip install ipykernel
to install ipykernel in this environment.Run
python -m ipykernel install --user --name=<myenv>
where<myenv>
is the name of the environment.
Launching Jupyter Notebook
Open the "Basic Jupyter Notebook with Anaconda" app on the Open OnDemand interface
Under "Oscar Anaconda module", choose "anaconda/2020.02"
Enter the name of the conda environment in "Conda Env"
Choose the other options as required.
Click "Launch" to start the job
Click "Connect to Jupyter" on the next screen.
To start a new notebook, click "New" -> <myenv> where <myenv> is the environment.
For starting a pre-existing notebook, open the notebook. In the Jupyter interface, click "Kernel" -> "Change Kernel" -> <myenv> where myenv is the name of the environment.
Last updated