Anaconda is an Open-Source distribution for Python & R programming languages. It is being used widely for Machine Learning, Data Science, etc. It has more than 1500 python/R data packages & is an industry-standard for developing, testing, and training on a single machine.

With anaconda’s conda, we can manage dependencies, libraries & environments. We can also use it with a number of applications like TensorFlow, Dask, Numba, Boken, Datashader, etc to develop and train machine learning and deep learning models or analyze data with scalability and performance or to visualize results.

Recommended Read: How to install MySQL on Ubuntu

Also Read: How to install PIP on Ubuntu- Python Package Manager

We have already discussed how to install Conda (anaconda) on Ubuntu & on CentOS/RHEL. Lets now discuss some Conda commands that we can use for package management.

Conda Commands Cheat Sheet

Check conda version

# conda info

Install a Package

# conda install package_name

For example,

# conda install spyder

Once a package has been installed, we can start it from the terminal,

# spyder

Update a package

# conda update package_name

For example,

# conda update package_name

Update conda to the latest version

To update conda to the latest version, use

# conda update conda

Remove a package

# conda remove package_name

For example,

# conda remove spyder

Search a package

To look for a particular package, use the following command,

# conda search package_name

Create a new environment

# conda create –name env_name

For example, if we need to create a new environment & install another python version on it, like python 3.6, use the following command,

# conda create –name test_py36 python=3.6

This way we can maintain many versions of python on a single system. We can also create a new environment with a package installed,

# conda create –name jupyter-env jupyter

List all created environments

# conda env list

Activate an environment

To activate the created environment, use

# source activate test_py36

Deactivate an environment

To delete an environment, use the following command,

# source deactivate

List all packages installed in an environment

# conda list

Delete an environment

To delete an environment along with all installed packages, use

# conda remove –name test_py36

Make a clone of an environment

To create an exact copy of an environment, we can use the following command,

# conda create –clone test_py36 –name test_py36-2

Save an environment to a text file

This is sort of like a backup, we can save an environment to a text file, which can later be used to create a new environment. To create a text file,

# conda list –explicit > backup_test_py36.txt

Restore an environment from a text file

To restore the environment saved to a text file, use the following command,

# conda env create –file backup_test_py36.txt

Conda Help

To get help about a command use,

# conda –help

or we can also use it like,

# conda remove –help

This concludes our tutorial on Conda commands for beginners. Please do let us know if you have any questions, queries or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.