Show Menu
Cheatography

Conda CLI Cheat Sheet by

Common commands used in Conda package management

Attrib­ution

Creating enviro­nments

# By name only
conda create -n myenv 
# By name and with packages
conda create -n myenv python=3.11 jinja2=3.1.4 wheel
# From file
conda env create -f environment.yml -n myenv

Activa­tin­g/d­eac­tiv­ating enviro­nments

Activate an enviro­nment:
conda activate myenv


Deactivate an enviro­nment:
conda deactivate


Switch to base enviro­nment (same as deacti­vat­ing):
conda activate

Listing enviro­nments

conda info --envs
conda info -e

List packages in an enviro­nment

conda list

Export enviro­nment details

conda env export --no-builds --from-history
--no-b­uilds means build numbers are not included (this is best practice).
--from­-hi­story means only explicitly installed packages are listed.

Add > enviro­nme­nt.yml to the end to export the results to a file called
enviro­nme­nt.yml
(this will overwrite a file with the same name, if it exists).

Deleting an enviro­nment

conda remove -n myenv --all
 

Install packages into current enviro­nment

conda activate myenv
conda install matplotlib

Install specific package version

conda install numpy=1.11
conda install numpy==1.11
conda install "numpy>1.11"
conda install "numpy=1.11.1|1.11.3"
conda install "numpy>=1.8,<2"

Specify an enviro­nment to install packages in

conda install --name myenv matplotlib

Install packages based on file

conda env update -n my_env --file environment.yaml

Install package from non-de­fault channel

conda install conda-forge::numpy

Install package from URL

                   
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Python Virtual Environments Cheat Sheet