Multiple Jupyter Notebook Kernels
Last updated
Last updated
Use Coda or venv to manage packages environment with specific Python versions
A cooperatively isolated runtime environment that allows Python users and applications to install and upgrade Python distribution packages without interfering with the behaviour of other Python applications running on the same system.
Reference: Virtual Environments and Packages ⇗
We can choose the Conda way or the standard Python way to achieve it.
Ensure Conda is installed
Update Conda
Create a new environment with desired Python version
Activate the new environment
In the new environment, install ipykernel
Register a new ipykernel
Launch a new Notebook using the myenv
kernel
In the notebook script !python -V
may return the incorrect version. The system level Python may be returned, and not the version in use in the current kernel environment.
Open Terminal and run, it will create a venv corresponding to the specific_python_version
and activate/switch to the venv:
then install iPython kernel package and register a new ipykernel in the current venv:
list available kernel spec for the verification
Activate virtualenv
Launch Notebook with specific kernel/venv
Switch Notebook Kernel anytime
Verify Python version in Notebook
Activate the specific virtual environment.
The Conda way
or the standard Python way
Then install the specific library version in this virtual environment. The dependency in this environment is independent from others.
The library/package version varies with different kernels(virtual environment)