Conda CLI Cheat-Sheet
Overview
The conda command is the primary interface for managing installations of various packages.
Many frequently used command options that use 2 dashes (–) can be abbreviated using 1 dash and the first letter of the option.
–envs -> -e –name -> -n
Managing Conda
Get conda version:
– conda –version conda -V
Update conda to the current version:
– conda update conda
Managing Environments
Conda allows you to create separate environments containing files, packages and dependencies that do not interact with each other.
The default conda environment is named base. Keep programs isolated by creating separate environments.
Creating a new environment and installing a package in it.
– conda create –name envname tensorflow
– conda create -n envname tensorflow
Conda checks to see what additional packages tensorflow will need, and asks if you want to proceed.
To activate the new environment
– conda activate envname
To see a list of all you Environments
– conda info –envs
– conda info -e
To change current environment back to base
– conda activate
To deactivate current environment
– conda deactivate
Delete an environment
– conda env remove –name envname
Managing Python
When a new environment is created conda installs the same Python version you used when you downloaded and installed Anaconda.
To use a different version of Python create a new environment and specify the version of Python that you want.
– conda create –name envname python=2.7
– conda create -n envname python=3.5
Verify which version of Python is in your current environment
– python –version python -V
Managing packages
To check if a package is available from the anaconda repository
– conda search tensorflow
If conda displays a list of packages with that name you know that the package is available on the Anaconda repository.
To install package into current environment
– conda install tensorflow
To list all packages available in current environment
– conda list
Sharing Environments
Make an exact copy of an environment
– conda create –clone envname –name newenv
Export an environment to a YAML file that can be read on Windows, macOS and Linux
– conda env export –name envname > envname.yml
Create an environment from the file named environment.yml in the current directory
– conda env create
Additional Useful Commands
Detailed information about package version
– conda search pkgname –info
Remove unused cached package version
– conda clean –packages
Remove a package from an environment
– conda uninstall pkgname –name envname