Virtual environment
A virtual environment is a private set of Python packages for one project. What you install there stays there, so each project keeps the versions it needs.
In VS Code you create one from the Command Palette: Python: Create Environment → Venv. It shows up as a .venv folder inside your project, and you pick it as your notebook's kernel.
One project can run Altair 5 while an older one keeps Altair 4, each in its own environment.
R users: it's the same idea as renv.
Learn more
Related terms
- Package
A package is a bundle of code someone else wrote that you install to give Python new tools. pandas and Altair are packages.
- Command Palette
The Command Palette is VS Code's search box for every command it has. Open it with Ctrl+Shift+P (Cmd+Shift+P on a Mac), type a few words and press Enter.
- VS Code
VS Code (Visual Studio Code) is a free code editor from Microsoft. With its Python and Jupyter extensions, it runs notebooks right inside the editor.