Reproducible computational environments with Conda
5 November 2025
- In production
- Due to Anaconda Terms of Service, the use of alternative, community-supported channels is recommended in production
- Miniforge is the preferred
conda-forgeinstaller- Follow Miniforge installation instructions for your OS
- To use the default Anaconda / Miniconda distributions in production, make sure to add the following to the
.condarcfile:
. . .
Command Line Interface
command + Space and search
Terminalanaconda and select Anaconda Prompt or
Anaconda Powershell PromptA directory that contains specific installed packages (system libraries, python/R modules, …).
The default environment that you have when installing conda.
. . .
Which version of conda are you running?
Inspect the output of conda info especially:
platform, Python version, active environment, base environment and
channel URLs.
$ conda create --name py38 python=3.8
$ conda create --name py38-clone --clone py38
$ conda env list--name py38 - py38 is the name of
the environmentpython=3.8 - python package version
3.8 is installed in the new environment--clone py38 - py38 is the name of
the cloned existing environmentconda env list - is equivalent with
conda info --envCheck Python version on:
$ python --version
$ conda activate
(base)$ python --version
(base)$ conda activate py38
(py38)$ python --versionconda activate - the default (base)
environment is activatedconda activate py38 - py38 is the
name of the environmentlist --name base - base is the name
of the environmentlist python - only packages matching
python string (regular expression) are listedlist ^lib - only packages starting with
lib string (regular expression) are listedConda channels
(py38)$ conda search numpy=1.21
(py38)$ conda install numpy=1.21.6
(py38)$ conda install pandas="<1.5"install pandas="<1.5" - the quotes are
mandatory(py38)$ conda update pandas
(py38)$ conda update --all
(py38)$ conda list --revisions
(py38)$ conda install --revision 2
(py38)$ conda list --revisionsupdate ... pandas - update pandas
to the latest compatible versionupdate --all - update all packageslist --revisions - list history of changesinstall --revision 2 - restore to revision
2A YAML file that contains all information to create an environment.
YAML file: seaborn.yml
name: seaborn
# important: do not use 'defaults', but always include 'nodefaults'
- conda-forge
- nodefaults
dependencies:
- seaborn=0.12.2Note: seaborn is is a
Python data visualization library based on matplotlib.
(py38)$ conda env create --file seaborn.yml
(py38)$ conda activate seaborn
(seaborn)$ conda env export
(seaborn)$ conda env export --no-builds
(seaborn)$ conda env export --from-history
(seaborn)$ conda env export --no-builds > seaborn_export.yaml
(seaborn)$ conda env create --file seaborn_export.yaml --name seaborn_exportenv export - all installed packages are exported (in
yaml format)env export --no-builds - the build specification is
removedenv export --from-history - all packages that you
explicitly asked forNote: The build specification is generally platform dependent.
Note: The packages might not be available on all platforms.
. . .
A text file that contains all information to create an identical environment.
(seaborn)$ conda list --explicit
(seaborn)$ conda list --explicit > seaborn_spec_file.txt
(seaborn)$ conda create --name seaborn_explicit --file seaborn_spec_file.txtconda create --file seaborn_spec_file.txt - conda
does not check the platform nor the dependenciesWarning: Use the spec file on a similar platform.
Finally, try yourself to remove some or all of the environments that we just created.
Hint: Have a look at the documentation for the
conda env command: conda env --help
Note: You cannot remove the active environment!