When you first load into Jupyter Notebook/Lab you can choose to create a new notebook with the kernel of your choice using the New drop down menu.

Kernels that are inside environments will load that environment upon notebook creation. 


You can see which kernel is loaded by looking at the label below the Logout button. For example a new notebook was created using the base environment.


You can always check which kernel (and environment) is active by running a cell containing !conda list 


To change the kernel (and thus the environment) in a notebook that is already open go to the Kernel menu and choose the kernel you want to switch to via Change kernel.


In the example below the same notebook (Untitled11) is now running the kernel for an environment called bmig_6203_test. 

Again the kernel is indicated below the Logout button so you know what kernel (and environment) is active at any given time.


Running !conda list in a new cell confirms that the bmig_6203_test environment is active now. 

The previous !conda list output is retained by the notebook as it would with your own code if you wanted to run multiple blocks of code that used different environments that you changed on the fly.


  • No labels