Environments — conda 25.3.2.dev38 documentation (original) (raw)

An environment is a directory that contains a specific collection of packages that you have installed. For example, you may have one environment with NumPy 1.7 and its dependencies, and another environment with NumPy 1.6 for legacy testing. If you change one environment, your other environments are not affected. You can easily activate or deactivate environments, which is how you switch between them. You can also share your environment with someone by giving them a copy of yourenvironment.yaml file. For more information, seeManaging environments.

Conda directory structure#

ROOT_DIR#

The directory where the conda distribution was installed into.

EXAMPLES:

/opt/Anaconda #Linux C:\Anaconda #Windows

/pkgs#

Also referred to as PKGS_DIR. This directory contains decompressed packages, ready to be linked in conda environments. Each package resides in a subdirectory corresponding to its canonical name.

/envs#

The system location for additional conda environments to be created.

The following subdirectories comprise the default Anaconda environment:

/bin

/include

/lib

/share

Other conda environments usually contain the same subdirectories as the default environment.

Virtual environments#

A virtual environment is a tool that helps to keep dependencies required by different projects separate by creating isolated spaces for them that contain per-project dependencies for them.

Users can create virtual environments using one of several tools such as Pipenv or Poetry, or a conda virtual environment. Pipenv and Poetry are based around Python's built-in venv library, whereas conda has its own notion of virtual environments that is lower-level (Python itself is a dependency provided in conda environments).

Scroll to the right in the table below.

Some other traits are:

Why use venv-based virtual environments#

Why use conda virtual environments?#

Workflow differentiators#

Some questions to consider as you determine your preferred workflow and virtual environment:

Package system differentiators#

There are potential benefits for choosing PyPI or conda.

PyPI has one global namespace and distributed ownership of that namespace. Because of this, it is easier within PyPI to have single sources for a package directly from package maintainers.

Conda has unlimited namespaces (channels) and distributed ownership of a given channel. As such, it is easier to ensure binary compatibility within a channel using conda.