Conda Environments

Carson West

Virtual Environments

Conda Environments

Conda environments are isolated spaces that allow you to manage different project dependencies without conflicts. This is crucial when working on multiple projects that require different versions of Python or packages.

Key features:

Creating an environment:

conda create -n myenv python=3.9 pandas numpy

This creates an environment named myenv with Python 3.9, pandas, and numpy. -n specifies the environment name.

Activating an environment:

conda activate myenv

Deactivating an environment:

conda deactivate

Listing environments:

conda env list

Exporting an environment:

conda env export > environment.yml

This creates a YAML file (environment.yml) that describes your environment. You can then recreate it on another machine using:

conda env create -f environment.yml

Removing an environment:

conda env remove -n myenv

Conda Environment YAML Files (Python Package Management) Virtual Environments vs Conda Environments