Conda: Choose where packages are downloaded

Viewed 10158

I don't have enough space in my default conda directory so I want conda packages to be downloaded at a different location. I have a conda environment created and activated at

/different_drive/condaenv 

Based on what I found online, I tried editing the .condarc file to have

pkgs_dirs
 - /different_drive/pkgs

and edited the permission of the default directory

/home/user/conda/pkgs/

to read-only. However, I just get permission denied errors as conda still tries to download the files to the default directory. Any suggestions on what I can do to change the download location of the packages?

3 Answers

In case other people encounter the same problem, as suggested in one of the comments here:

conda config --add pkgs_dirs /new_path_pkgs/

Verify that the pkgs_dirs path is changed:

conda config --show

The packages will be now saved in the new path.

The steps provided at the official conda documentation link, answers the question.

After creating the environment, activate it, then install your packages. The packages shall be installed within this environment and not the default location.

Update

Reproducing the commands below for quick reference:

Following command will create a new environment in a subdirectory of the current working directory called demo

conda create --prefix ./demo python=3.6 scipy=0.15.0

Now, activate the environment as follows:

conda activate ./demo

The environment prompt will have absolute path to the environment, to shorten it, use the trick mentioned at the link above.

I think you might be able to create a new environment with a different path and have your packages installed on that path. Or better you can change your existing conda environment to a new path where you'd have more space. Check this link out. I hope this helps you out.

Related