Conda Important Commands

Conda is a package manager that comes with Anaconda.

And i wanted to make a list of all this commands so that users can find them quickly when necessary…

To install a package, just substitute the package_name with the package you want to install in the following code.

conda install package_name

Similarly to uninstall or removing a package..

conda remove package_name

You can install multiple packages at the same time. Something like

It’s also possible to specify which version of a package you want by adding the version number such as

To update a package

If you want to update all packages in an environment, which is often useful, use

To list installed packages,

If you don’t know the exact name of the package you’re looking for, you can try searching with

For example, I know I want to install Beautiful Soup, but I'm not sure of the exact package name. So,

Note that your shell might expand the wildcard before running the conda command. To fix this, wrap the search string in single or double quotes like

It returns a list of the Beautiful Soup packages available with the appropriate package name,

conda package search result
conda package search result

conda can be used to create environments to isolate projects. To create an environment,

Here sets the name of your environment ( for name) and is the list of packages you want installed in the environment.

For example, to create an environment named and install numpy in it, type

To create an environment with a specific Python version, do something like

or

Once you have an environment created, use to enter it.

To leave the environment, type (on OSX/Linux).

On Windows, use

Note: and only work on conda 4.6 and later versions. For conda versions prior to 4.6, run or (on Windows), or (on OSX/Linux)

A really useful feature is sharing environments so others can install all the packages used in your code, with the correct versions. You can save the packages to a YAML file with

The first part writes out all the packages in the environment, including the Python version.

The file can now be shared and others will be able to create the same environment you used for the project.

To create an environment from an environment file use

This will create a new environment with the same name listed in

If you forget what your environments are named (happens to me sometimes), use to list out all the environments you've created.

If there are environments you don’t use anymore,

will remove the specified environment (here, named ).

To learn more about conda and how it fits in the Python ecosystem, check out this article by Jake Vanderplas: Conda myths and misconceptions. And here’s the conda documentation you can reference later, and a link to a cheatsheet to help you basic conda commands.

I am a programmer and developer. I have worked and contributed many personal and Open-Sourced projects.