Basic Package Management
Conda makes it easy to view, search, and install packages.Listing Installed Packages
If you installed the Anaconda Distribution, you will already have hundreds of packages installed. You can see what packages are installed by running:Searching for Packages
To see all the packages that are available:Installing Packages
To install a package, use:Working with Environments
The real power of conda comes from its ability to manage environments. In conda, an environment can be thought of as a completely separate installation.Why Use Environments?
Conda installs packages into environments efficiently using hard links by default when it is possible, so environments are space efficient, and take seconds to create. Environments allow you to:- Isolate project dependencies
- Use different versions of packages for different projects
- Avoid conflicts between package requirements
- Easily share reproducible environments
Understanding the Base Environment
The default environment, whichconda itself is installed into, is called base. This is the environment you’re using when you first open a terminal after installing Conda.
Creating Your First Environment
Let’s create a new environment for a machine learning project.Create the environment
To create an environment with PyTorch, run:This creates an environment called
ml-project with the latest version of PyTorch and its dependencies.You can create an environment with multiple packages at once by listing them:
Activate the environment
Once the environment is created, activate it:This puts the
bin directory of the ml-project environment in the front of the PATH, and sets it as the default environment for all subsequent conda commands.After activation, your terminal prompt will typically show the environment name:Install additional packages (optional)
With the environment activated, you can install additional packages:These packages will be installed only in the
ml-project environment.Quick Reference
Here’s a handy reference for the most common Conda commands:Example Workflow
Here’s a typical workflow for starting a new Python project:Work on your project
With the environment activated, all packages you install and use will be isolated to this project.
Next Steps
Now that you understand the basics, you can:- Explore the User Guide for more advanced features
- Check out the Command Reference for a complete list of commands
- Learn about building your own packages
- Join the conda community on Zulip