Cleaning up your Anaconda installations (2024)

If you've been using Anaconda Python for a while, and been creating multiple environments and adding/removing packages, you may have noticed that it's starting to take up a lot of disk space (sometimes tens of GBs).


Cleaning up your Anaconda installations (1)
Anaconda installation can get big

One reason is that anaconda environments are completely isolated workspaces from each other with their own copy of Python. So, the more environments you have, the larger the space needed by anaconda. But the other reason is that anaconda keeps a cache of the package files, tarballs etc. of the packages you've installed. This is great when you need to reinstall the same packages. But, over time, the space can add up.

So, how do we clean up this cache and regain some disk space?


We can try going into the 'pkgs' directory and manually clean them up.

Or, we can go the easy way, by using the 'conda clean' command.

You can also run the command in dry-run mode to see what would get cleaned up,

conda clean --all --dry-run

Once you're satisfied with what might be deleted, you can run the clean up,

conda clean --all

This will clean the index cache, lock files, tarballs, unused cache packages, and the source cache.

Cleaning up your Anaconda installations (2)
Cleaning the tarballs
Cleaning up your Anaconda installations (3)
Cleaning the tarballs #2
Cleaning up your Anaconda installations (4)
Cleaning the packages

Cleaning up your Anaconda installations (5)
Cleaning the packages #2
Cleaning up your Anaconda installations (6)
Cleaning the source cache

Based on your usage, this would clean up from a couple of GBs to maybe 10+GB.

See the command in action,

Cleaning up your Anaconda installations (7)

Build Deeper: The Path to Deep Learning

Learn the bleeding edge of AI in the most practical way: By getting hands-on with Python, TensorFlow, Keras, and OpenCV. Go a little deeper...

Get your copy now!

Cleaning up your Anaconda installations (2024)

FAQs

How to clean up Anaconda environment? ›

Conda clean is a command-line function that removes unused packages and caches from your Conda environment. It's a handy tool for freeing up disk space and keeping your Conda environment tidy. The command has several options, including -p to remove unused packages, -t to remove tarballs, and -a to remove everything.

How do I clean my Anaconda install? ›

You can also use the anaconda-clean tool. Just open Terminal in your Mac and run these commands – conda install anaconda-clean and anaconda-clean or anaconda-clean –yes. To remove the entire Anaconda directory, you can run the command – rm -rf ~/anaconda3 in Terminal. To remove anaconda backups, run rm -rf ~/.

Will I lose everything if I uninstall Anaconda? ›

The uninstall procedure might leave behind certain artifacts, such as desktop shortcuts or supplementary files, that must be deleted manually after completion. This is a known issue that is being addressed.

How do I completely remove an Anaconda environment? ›

Go to search box in your system and type 'Anaconda Prompt', which is already on your system and open it.
  1. search for anaconda prompt.
  2. list of environments command.
  3. conda deactivate command.
  4. delete env command.
  5. final verification.
Oct 16, 2023

Do conda environments take up a lot of space? ›

Conda environments can take up a lot of disk space which can quickly fill up the /home disk. It is recommended that you create a directory on a data disk that has more disk space and create a symbolic link from the . conda directory so the environments will be stored on the data disk.

Is Anaconda a good environment? ›

Yes, Anaconda can be a good choice for beginners in Python programming, especially those interested in data science and machine learning. Its comprehensive package management and pre-installed libraries simplify the setup process and allow beginners to focus on learning Python.

Why does Anaconda take so much space? ›

If you're maxing out your storage space, the most likely culprits are custom environments, which are all the environments you see in the Disk Manager. To gain more storage, delete these environments (and optionally download them for later use) or upgrade your subscription.

What to do after installing Anaconda? ›

After the installation of Anaconda is complete, you can go to the Windows start menu and select the Anaconda Prompt. This opens the Anaconda Prompt. Anaconda is the Python distribution and the Anaconda Prompt is a command line shell (a program where you type in commands instead of using a mouse).

How do I remove everything from conda? ›

Use --all flag to remove all packages and the environment itself. This command will also remove any package that depends on any of the specified packages as well---unless a replacement can be found without that dependency.

What is Anaconda-clean? ›

anaconda-clean. This will run through the configuration files/directories on your system and give you the option to delete each one. Optional: To automatically delete all files and directories, run: anaconda-clean --yes.

What happens when you uninstall Anaconda? ›

A full uninstall removes all traces of the configuration files and directories from Anaconda and its programs with the anaconda-clean program (skip this and go to the Simple remove instructions if you can't do this). In Windows, open Anaconda Prompt.

Why is the conda install so slow? ›

Unlike many package managers, Anaconda's repositories generally don't filter or remove old packages from the index. This allows old environments to be easily recreated. However, it does mean that the index metadata is always growing, and thus conda becomes slower as the number of packages increases.

Where are conda environments stored? ›

Where do Conda environments live? Environments created with conda , by default, live in the envs/ folder of your miniconda3 (or anaconda3 ) directory the absolute path to which will look something the following: /Users/$USERNAME/miniconda3/envs or C:\Users\$USERNAME\Anaconda3 .

What is the difference between Miniconda and Anaconda? ›

Miniconda: Key Differences. The main difference between Anaconda and Miniconda lies in their size and the number of pre-installed packages. Anaconda is larger and comes with a vast array of pre-installed packages, while Miniconda is smaller and only includes Conda and Python.

Can I delete the Anaconda pkgs folder? ›

the 'pkgs' directory is only a cache. You can remove it completely is you want to. for you, see "conda clean -h".

How do you check an Anaconda environment? ›

To see a list of all packages installed in a specific environment:
  1. If the environment is not activated, in your terminal window, run: conda list -n myenv.
  2. If the environment is activated, in your terminal window, run: conda list.
  3. To see if a specific package is installed in an environment, in your terminal window, run:

Where is my conda cache? ›

By default, the package cache is in your home directory ($HOME/. conda/pkgs). If installing a large amount of software that may cause the home directory quota to be exceeded, you can configure another directory to be the package cache by adding a pkgs_dirs list to the $HOME/. condarc file.

Top Articles
Latest Posts
Article information

Author: Mrs. Angelic Larkin

Last Updated:

Views: 5867

Rating: 4.7 / 5 (47 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Mrs. Angelic Larkin

Birthday: 1992-06-28

Address: Apt. 413 8275 Mueller Overpass, South Magnolia, IA 99527-6023

Phone: +6824704719725

Job: District Real-Estate Facilitator

Hobby: Letterboxing, Vacation, Poi, Homebrewing, Mountain biking, Slacklining, Cabaret

Introduction: My name is Mrs. Angelic Larkin, I am a cute, charming, funny, determined, inexpensive, joyous, cheerful person who loves writing and wants to share my knowledge and understanding with you.