Show Menu
Cheatography

Conda CLI Cheat Sheet by

Common commands used in Conda package management

Attrib­ution

Creating enviro­nments

conda create -n myenv python=3.11 jinja2=3.1.4 wheel
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

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
                   
 

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