When was the last time you checked how much disk space conda is using?

If you’re like many developers, the answer is probably “never.” Conda just works, environments spin up when you need them, and you don’t really think about what’s happening behind the scenes. Or maybe you’ve noticed your conda installation has grown larger than expected, and you’re wondering if you need to start deleting environments.

Before you do anything drastic, let me introduce you to a command that’s been sitting quietly in your conda toolkit this whole time. It can free up gigabytes of disk space while keeping your environments working perfectly.

The command? conda clean.

The Cache You Didn’t Know You Had

Every time you install a package with conda, it downloads the package file (a tarball) and extracts it into a package cache. This is actually a smart design because it speeds up future installations. If you create a new environment that needs numpy, and you’ve already downloaded numpy before, conda can reuse that cached copy instead of downloading it again.

But conda keeps these caches indefinitely. Every package version you’ve ever installed. Every tarball you’ve ever downloaded. All those experiments where you tried different package combinations. They’re all still sitting in your .conda directory or pkgs folder.

Over months or years, this adds up. A lot.

What Conda Clean Actually Does

conda clean removes cached files that you’re no longer using:

  • Package tarballs (the compressed files conda downloaded)
  • Extracted packages that no current environment is using
  • Index cache (metadata from conda channels)
  • Temporary files from installations

It only removes things your environments don’t need. (Note: If you’ve configured environments to use symlinks to the package cache—uncommon in default setups—use caution with conda clean --packages and conda clean --all.)

What Conda Clean Doesn’t Do

conda clean will not:

  • Delete or modify your environments
  • Remove packages your environments are currently using
  • Speed up conda

Think of it like clearing out a warehouse. The machinery on the floor keeps running. You’re just removing the spare parts sitting in storage.

Try It Yourself

Start with a dry run to see what you’re working with:

conda clean --all --dry-run

This shows you exactly what would be removed and how much space you’d reclaim, without actually deleting anything. Savings typically range from a few hundred MB to several GB.

If you’re comfortable with the results:

conda clean --all

You can also target specific types of cache. For example:

# Just logfiles
conda clean --logfiles

# Just the downloaded tarballs
conda clean --tarballs

# Just temporary files that could not be deleted earlier due to being in use
conda clean --tempfiles path/to/tempfiles

Should You Run This Regularly?

It depends on your situation. If you:

  • Work on a laptop with limited storage
  • Create and delete environments frequently
  • Run conda in CI/CD pipelines
  • Need to back up or sync your development machine

Then yes, running conda clean periodically makes sense. I personally run conda clean after deleting environments.

If you have plenty of disk space and infrequently create new environments, the cache is actually helping you by speeding up installations. But it’s still worth knowing this command exists in case your workflows or practices change.

The Bottom Line

conda clean is one of those commands that’s good to know, even if you don’t need it right now. It’s safe, it’s straightforward, and you might be surprised by how much space it frees up.

Run that dry run command and see what you find. I once pulled out a laptop I hadn’t run conda clean in two years and freed up 18GB! You might also be sitting on gigabytes of cached packages you forgot existed.

Want to learn more about conda environments? Check out the Ultimate Conda Environment Management Guide.