My ~/anaconda
directory is taking up too much disk space (10GB), although I have only five environments and have run conda clean
. I discovered that when I try to create a new conda environment, Anaconda displays a very long list of packages to be downloaded, which seems to include a full scientific Python stack (Python interpreter, numpy, scipy, etc.). It seems that Anaconda is installing everything independently for each environment. Is this true?
The following list contains some purely speculative ways which could potentially solve the space problem:
pip
to install packages, as conda install
often fails. Does conda install
do some smart job to reuse packages already installed somewhere else?(Debugging information) The sizes of my four environment directories under ~/anaconda/envs
are between 1.2GB and 2.6GB. Is this normal?
By default, conda creates a new environment folder and installs all the packages inside . conda folder in your home directory but this space is limited and cannot be shared with other users.
Go to Environments tab just below the Home tab and from there we can check what all packages are installed and what is not. It is very easy to install any package through anaconda navigator, simply search the required package, select package and click on apply to install it.
Virtual environments depend on the base system install of Python, whereas Conda environments are independent of the base install.
Conda installs packages into the anaconda/pkgs directory. If conda cannot find the file, try using an absolute path name instead of a relative path name. Installing packages directly from the file does not resolve dependencies.
I believe the answer to your main question lies in the difference between Anaconda vs Miniconda. Anaconda includes a long list of packages that get installed automatically into each environment that you create. Miniconda creates barebone conda virtual environments (which don't contain many packages at all). Switching to Miniconda should substantially reduce the size/number of packages in your environments. Anaconda is about 2GB, while Miniconda is closer to 100MB.
Conda also uses hardlinks for packages installed vs conda install
. A good description of hardlinks can be found here. They basically link dependencies across multiple environments like you've described above. Packages installed via pip
are not hardlinked, so they cannot take advantage of the space savings that conda packages offer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With