Anaconda Cheat Sheet

Conda basics

conda infoVerify conda is installed, check version number
conda info –envList of install python environments
conda update condaUpdate conda to the current version
conda install PACKAGENAMEInstall a package included in Anaconda
conda update PACKAGENAMEUpdate any installed program
conda COMMANDNAME –help
conda install –help
Command line help

Using environments

conda create –name py35 python=3.5Create a new environment named py35, install Python 3.5
conda activate py35Activate the new environment to use it
conda env listGet a list of all my environments, active
environment is shown with *
conda create –clone py35 –name py35-2Make exact copy of an environment
conda listList all packages and versions installed in active environment
conda list –revisionsList the history of each change to the current environment
conda install –revision 2Restore environment to a previous revision
conda list –explicit > bio-env.txtSave environment to a text file
conda env remove –name bio-envDelete an environment and everything in it
conda deactivateDeactivate the current environment
Note: Environment is already activated
conda env create –file bio-env.txtCreate environment from a text file
conda create –name bio-env biopythonStack commands: create a new environment, name it bio-env and install the biopython package

Finding conda packages

conda search PACKAGENAMEUse conda to search for a package list of all packages in Anaconda

Installing and updating packages

conda install jupyterInstall a new package (Jupyter Notebook) in the active environment
jupyter-notebookRun an installed package (Jupyter Notebook)
conda install –name bio-env toolzInstall a new package (toolz) in a different environment (bio-env)
conda update scikit-learnUpdate a package in the current environment
conda install –channel conda-forge boltonsInstall a package (boltons) from a specific channel (conda-forge)
pip install boltonsInstall a package directly from PyPI into the current active environment using pip
conda remove –name bio-env toolz boltonsRemove one or more packages (toolz, boltons) from a specific environment (bio-env)

Managing multiple versions of Python

conda create –name py34 python=3.4Install different version of Python in
a new environment named py34
conda activate py34
Switch to the new environment that has
a different version of Python
Windows: where python
Linux, macOS: which -a python
Show the locations of all versions of Python that are
currently in the path
NOTE: The first version of Python in the list will be executed

Specifying version numbers

Ways to specify a package version number for use with conda create or conda install commands, and in meta.yaml files.

Constraint type SpecificationResult
Fuzzynumpy=, 1.11.1, 1.11.2, 1.11.18 etc.

Greater than or equal to “numpy>=1.11”1.11.0 or higher
OR“numpy=1.11.1|1.11.3”1.11.1, 1.11.3
AND“numpy>=1.8,<2”1.8, 1.9, not 2.0