Description
Isolating each research project's interpreter and libraries so that analyses run with known package versions and do not break when other projects update.
A virtual environment is a self-contained interpreter plus library set scoped to one project. Without it, upgrading pandas or scikit-learn for one study can silently change results in another, for example by altering default parameters in factor analysis or clustering. The rigour comes from one environment per project, created from a declared specification file, and from never installing packages ad hoc into the base interpreter. conda additionally manages non-Python binaries such as ffmpeg or CUDA libraries, which matters for transcription and transformer models. Combined with a lockfile, an environment lets a colleague or reviewer recreate the exact computational instrument used for an analysis months later.
Attributes
- Discipline
- Research Design & Rigor
- Loss type
- Unmigrated
- Stage
- Evaluation
- Data
- Analytical / expert
- Effort
- Hours
Steps
- Create one environment per project (python -m venv .venv or conda create -n project python=3.11) at project start.
- Record every dependency in a specification file (requirements.txt, pyproject.toml or environment.yml) rather than installing ad hoc.
- Pin exact versions for anything that affects results (pandas, numpy, scikit-learn, statsmodels, factor_analyzer) once analysis begins.
- Never install into the base or system interpreter; activate the project environment before every session.
- Rebuild the environment from the specification file on a clean machine or container at least once before reporting results.
- Register the environment as a named Jupyter kernel so notebooks cannot accidentally run under a different interpreter.
Sources
- Python (pandas, numpy, pathlib)
- Jupyter Lab
- Git
- conda/venv
- cookiecutter project templates
- Wilson, G. et al. (2017) Good enough practices in scientific computing. PLOS Computational Biology
- The Inquiry Series, C1 — The Python Research Environment — Setup, Philosophy & Reproducibility
Also known as
- Isolated Python environments
- venv
- conda environments
Categories
- Research Operations
- Research Design & Rigor