Python¶
The Python Ecosystem modules of our Basics of Computing Environments for Scientists ("compenv") lectures explain various concepts in detail.
Keywords: pip, virtualenv, venv, pyenv, pipenv, uv, poetry, pip-review, pipx
Virtual Environments¶
Most systems ship Python with the PEP 668 flag that it's "externally managed". This protects the system-wide packages by preventing the use of pip to install packages globally or within the user scope. Instead users should create proper virtual environments. Small ones may fit in your home, but larger ones should go to the groupshare or scratch disk.
Note that most virtual environments must be re-created when switching operating system or upgrading the Python interpreter. Please follow the best practices by knowing which Python packages you need and how to install them.
If you have no favorite Python packaging tool yet, we invite you to give uv a try. It considerably facilitates the management of virtual environments and its uv.lock file ensures best portabiliy and reproducibility across platforms.
Python Interpreters¶
The system Python should be fine for most people. But you may also decide to install custom versions of the Python interpreter, either with uv or pyenv.
Python on Windows¶
Refer to our dedicated documentation on Python on Windows.
Custom iPython Kernel for Jupyter or JupyterHub¶
Details are found in the Jupyter section in compenv.