Using Virtual Environments and Jupyter Notebooks in OnDemand
This information is part of a collection of information on constructing and using virtual environments.
Follow these steps to use your VE in a Jupyter Notebook interactive session on OnDemand:
Check for
ipykernel
installation. Ensure thatipykernel
is installed in your environment. After activating your environment, you can run thepip freeze
command to list all the installed libraries. Ifipykernel
is not listed, you can install it with thepip install ipykernel
command.Set up the environment ‘Kernel’. Assuming your environment is named
my_env
, activate it and run the following command:
python -m ipykernel install --name my_env --display-name "Python (my_env)"
This will create a Jupyter Kernel named “Python (my_env),” which allows you to use ‘my_env’ within your notebooks.
Launch and select the Kernel in Jupyter Notebook. After launching Jupyter Notebook on OnDemand (refer to the video tutorial here), open your notebook, then go to ‘Kernel’ in the top menu bar, select ‘Change Kernel’, and choose ‘Python (my_env)’ kernel.