Tuesday, July 14, 2026

use digital environments in Python

Utilizing Python digital environments with Jupyter notebooks

If you happen to’re utilizing Jupyter notebooks (aka IPython notebooks), and you have already got Jupyter put in systemwide, create your digital setting and activate it. Then, out of your digital setting listing, run pip set up ipykernel so as to add the wanted parts for IPython. Lastly, run ipython kernel set up —consumer —identify=, the place project_name is a reputation you wish to affiliate with that specific mission. From there it’s best to have the ability to launch Jupyter and change to the IPython kernel you put in contained in the digital setting.

Upgrading Python digital environments

If you improve a Python runtime in your system, digital environments that use that model of Python aren’t routinely upgraded. That’s your duty. And that’s by design, as a result of unwitting upgrades to Python variations can break their attendant packages.

If you happen to’ve upgraded an present Python interpreter with a minor level improve—e.g., from Python 3.13.1 to Python 3.13.3—you possibly can improve any corresponding digital environments simply sufficient. From a command immediate within the mission listing, enter:

python -m venv /path/to/venv --upgrade

Don’t activate the digital setting beforehand, or the improve might not work.

Alternatively, as famous above (see “Eradicating the Python digital setting”), you can elect to take away the venv utterly and recreate it utilizing your necessities.txt or pyproject.toml file.

If you happen to’ve put in a main new model of Python—e.g., you have already got Python 3.10 and also you now set up Python 3.11 alongside it—you’ll have to create a brand new digital setting that particularly makes use of the brand new main level model. Do not try and improve an present digital setting to the next main level model of Python.

Related Articles

Latest Articles