devcrea

How to List Conda Environments Easily

Learn how to list all Conda environments using conda env list and conda info --envs. Includes flags for JSON output, disk usage, and package listing.

// The short answer

List Conda environments with conda env list or conda info --envs; the active environment is marked with an asterisk. Add --json when another tool needs machine-readable output, use the printed path to inspect or remove a specific environment, and activate the correct name before installing packages so they do not land in the wrong project.

Full walkthrough, edge cases and why it works
In this guide · 6 sections
  1. 01Why List Conda Environments?
  2. 02Commands to List All Conda Environments
  3. 03Useful Flags: --json and --size
  4. 04List Packages Inside a Specific Environment
  5. 05Activate an Environment After Listing
  6. 06Common Errors and How to Fix Them

If you work on multiple Python projects, you've probably created several Conda environments over time. Knowing which environments exist, where they are stored, and which one is currently active saves you time and prevents "why isn't my package installed?" moments. This guide covers every way to list Conda environments, from the basic command to useful flags for checking disk usage and package details.

Why List Conda Environments?

Conda environments keep your project dependencies isolated. When you run conda env list, you get a clear picture of all your setups so you can confirm which environment is active before running a script, identify old or unused environments to delete and free up disk space, find the exact path to an environment when configuring IDEs like VS Code or PyCharm, and quickly switch to the right environment for a given project.

Once you know what's there, managing your environments becomes much easier. If you need to clean up old ones, the guide on removing Conda environments walks through safe deletion step by step.

Commands to List All Conda Environments

There are two equivalent commands that display all your Conda environments:

bash1 line
conda env list

or:

bash1 line
conda info --envs

Both produce the same output. The conda info --envs form is slightly older but still widely used, so you'll see both in tutorials and documentation.

Example output:

code5 lines
# conda environments:
#
base                  *  /home/user/anaconda3
data_science_env         /home/user/anaconda3/envs/data_science_env
web_dev_env              /home/user/anaconda3/envs/web_dev_env
  • The base environment is created automatically when you install Conda.
  • Custom environments like data_science_env appear below it with their full paths.
  • The asterisk (*) marks the currently active environment.

Useful Flags: --json and --size

The basic command works well for most cases, but Conda provides extra flags when you need more information.

JSON output is useful for scripts or automation:

bash1 line
conda env list --json

This outputs the environment list in JSON format, which you can pipe into tools like jq or parse with Python:

json7 lines
{
  "envs": [
    "/home/user/anaconda3",
    "/home/user/anaconda3/envs/data_science_env",
    "/home/user/anaconda3/envs/web_dev_env"
  ]
}

Disk usage per environment is helpful for identifying large environments:

bash1 line
conda env list --size

This adds a size column showing how much disk space each environment uses. Note that it only counts packages managed by Conda; files added manually after installation are not included.

List Packages Inside a Specific Environment

Listing your environments shows you which environments exist, but sometimes you need to see what's installed inside one. Use conda list with the -n flag and the environment name:

bash1 line
conda list -n data_science_env

If you want to check the environment you're currently in, just run:

bash1 line
conda list

You can also export the package list to a file, which is great for reproducing an environment on another machine:

bash1 line
conda list -n data_science_env --explicit > environment.txt

This ties directly into managing Python dependencies. If your project relies on specific environment variables alongside its packages, see how to set and use environment variables in Python for a clean project setup.

Activate an Environment After Listing

Once you've confirmed which environment you need, activate it with:

bash1 line
conda activate data_science_env

To switch back to the base environment:

bash1 line
conda activate base

And to deactivate the current environment entirely, returning to the system default:

bash1 line
conda deactivate

After activation, run conda env list again to confirm the asterisk has moved to your newly activated environment.

Common Errors and How to Fix Them

Command not found: If your terminal says conda: command not found, Conda is either not installed or not on your system's PATH. Reinstall Anaconda or Miniconda, or add the Conda binary directory to your PATH manually.

Empty environment list: If only base appears, you haven't created additional environments yet. Create one with:

bash1 line
conda create --name my_env python=3.11

Environment not showing up: If you created an environment outside the default Conda directory using --prefix, it won't appear in the list automatically. Use the full path to activate it:

bash1 line
conda activate /path/to/my_env

Permission issues: On shared systems or servers, you may not have read access to environments created by other users. Contact your system administrator if you need access to those environments.

Once you have the full list in front of you, spotting outdated or unused environments is easy. Removing them with conda remove --name env_name --all keeps your setup clean, and the conda environment removal page covers all the options, including how to handle environments created with a custom --prefix.

Quick answers

Frequently asked questions

What is the difference between conda env list and conda info --envs?

There is no functional difference. Both commands list all Conda environments on your system along with their file paths. conda env list is the more commonly used form in modern documentation, while conda info --envs is an older alias that does the same thing.

How do I list packages in a specific Conda environment without activating it?

Use the -n flag followed by the environment name: conda list -n my_env. This shows all packages installed in that environment without requiring you to activate it first.

Why does my Conda environment not show up in the list?

If you created the environment with a custom --prefix path outside the default Conda directory, it won't appear in conda env list. You can still activate it by providing its full path: conda activate /path/to/env.

How can I see the disk size of each Conda environment?

Run conda env list --size. This adds a size column to the output showing disk usage for each environment. The measurement covers only Conda-managed packages and excludes files added manually after installation.

How do I delete a Conda environment I found in the list?

Use conda remove --name my_env --all to completely remove an environment and all its packages. Make sure to deactivate it first if it is currently active.

Something wrong or out of date?

Tools change fast. Tell the editor what no longer works.