How to deal with "[Errno 122] Disk quota exceeded" problem when creating new environment by anaconda?
Asked Answered
P

3

11

I am trying to create a new environment for Python through Anaconda. But the error keeps coming out saying :

Solving environment: failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    OSError: [Errno 122] Disk quota exceeded

I am using the sentence below to create the new environment:

conda create --name cpost python=2.7 numpy=1.9

I understand that this might be related to the working directory, which is really limited in disk quota. So I copied the Anaconda directory fully to a larger disk-quota directory, and tried to create again. The same error came out. As I checked the error information, I noticed the following lines:

$ /nuist/u/home/liangxz/anaconda3/bin/conda create --name cpost python=2.7 numpy=1.9`

  environment variables:
                 CIO_TEST=<not set>
               CONDA_ROOT=/nuist/u/home/liangxz/anaconda3
               MODULEPATH=/nuist/p/public/app/Modules/modulefiles/app:/nuist/p/public/app/Module
                          s/modulefiles/compiler:/nuist/p/public/app/Modules/modulefiles/lib:/nu
                          ist/p/public/app/Modules/modulefiles/mpi
                     PATH=/nuist/u/home/liangxz/anaconda3/bin:/nuist/p/public/intel/compilers_an
                          d_libraries_2018.0.128/linux/bin/intel64:/nuist/p/public/intel/compile
                          rs_and_libraries_2018.0.128/linux/mpi/intel64/bin:/nuist/p/public/pgi/
                          linux86-64/17.10/bin:/nuist/p/public/pgi/linux86-64/17.10/bin:/opt/xca
                          t/bin:/opt/xcat/sbin:/opt/xcat/share/xcat/tools:/usr/lib64/qt-3.3/bin:
                          /opt/confluent/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
                          opt/ibutils/bin:/usr/lpp/mmfs/bin:/root/bin:/opt/pbs/default/bin:/nuis
                          t/u/home/liangxz/.local/bin:/nuist/u/home/liangxz/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : None
       user config file : /nuist/u/home/liangxz/.condarc
 populated config files :
          conda version : 4.5.4
    conda-build version : 3.10.5
         python version : 3.6.5.final.0
       base environment : /nuist/u/home/liangxz/anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /nuist/u/home/liangxz/anaconda3/pkgs
                          /nuist/u/home/liangxz/.conda/pkgs
       envs directories : /nuist/u/home/liangxz/anaconda3/envs
                          /nuist/u/home/liangxz/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-514.el7.x86_64 centos/7 glibc/2.17
                UID:GID : 1135:1135
             netrc file : None
           offline mode : False

I realized that the "user config file" is /nuist/u/home/liangxz/.condarc, and the "base environment" is "/nuist/u/home/liangxz/anaconda3 (writable)", which means even I copied an anaconda to a larger quota directory, the "writable directory" did not change and remained the small quota directory.(/nuist/u/home/liangxz/ is the small quota directory)

So my question here is how can I change the "base environments" and "envs directories" to the desired larger quota directory? Can I change it directly through some fixings? Or I must install Anaconda again in the bigger directory?

Phoenicia answered 27/4, 2019 at 8:44 Comment(3)
I'd be a bit worried that the hardlinking Conda does under the hood could have an issue just moving the whole folder to a new disk like this. I'm not clear on what the behavior would be, possibly you actually expanded the size of the Anaconda install even further, or you still have links back to the small quota disk, i.e., you didn't actually free any space. Maybe you can check du -sh envs/* and compare it to du -sh pkgs envs/*. They should come out differently if hardlinks are still active, but that still won't say where they link.Jebel
Thank you for your reply. I figured out how everything goes wrong yesterday. The command conda was set in the .bashrc file as export PATH="/nuist/u/home/liangxz/anaconda3/bin:$PATH", that means every time I tried to use the conda command, I actually used the anaconda3 installed in the small quota disk and the new env was about to be created in the small disk; even I copied a folder to the larger quota disk, which is useless at all. I then installed anaconda in the big quota disk and added the correct PATH in the bashrc file, problem was solved then.Phoenicia
BTW, you shouldn't be setting PATH like that manually since Conda v4.4. https://mcmap.net/q/21824/-how-can-i-run-condaJebel
E
3

Try following this official anaconda answer that enables adding different directories as your conda cache. I added a different directory where I had more space available and it solved the issue.

Earl answered 6/5, 2022 at 12:12 Comment(1)
The link you shared requires that I create an account on anaconda and hopefully get redirected to the right page with the content. Any chance you could improve your answer and describe step-by-step what should be done? Thanks!Watercraft
C
0

I solved this by deleting some of my conda environments. You can find all environments by typing conda env list in the terminal. This will show all environments with their names and paths. Select an environment that you are prepared to remove and type: rm -r <<Path to that environment>>.

Warning: This will delete that environment permanently, so choose wisely.

Crucible answered 4/11, 2021 at 13:11 Comment(1)
I needed to do this because I got a disk quota error when trying to remove a conda env...Carter
R
0

Note: This answer is only applicable if you have another folder where you have more disk space, as in OP's case.

TL;DR

### $DATA is the directory where you have more disk space
DATA=path/to/big/directory

### Specify the new default directories in which environments and package caches will be placed
conda config --add envs_dirs $DATA/.conda/envs
conda config --add pkgs_dirs $DATA/.conda/pkgs

### Create a new conda environment
conda create -n myEnv
conda activate myEnv

### Now, myEnv should have been created at the location path/to/big/directory/.conda/envs/myEnv
### To check this, one can use `echo $CONDA_PREFIX`

Longer answer

The main goal is having conda create the environment and saving the package caches somewhere under the directory where you have more disk space, henceforth called $DATA. Both are important, as both the envs and the pkgs folders can become quite large.

The directory where environments are created by default is determined by the envs_dirs entry in your .condarc file. Analogously, the directory where packages are caches is determined by the pkgs_dirs entry. You can show both of these with:

conda config --show envs_dirs
conda config --show pkgs_dirs

Now using conda config --add envs_dirs $DATA/.conda/envs will add $DATA/.conda/envs to the top of the list, making it the new default for environment creation. The directories that were previously in envs_dirs will still be there, which enables conda to still find all environments created previously.
conda config --add pkgs_dirs $DATA/.conda/pkgs does the analogous thing for packages.

If you don't want to change the default

If you want to place only this environment (and the directory that the package cache will end up in) in another location, you can do it as follows:

  • Change the environment variable CONDA_PKGS_DIRS to the desired value(s). This variable overrides the value given by pkgs_dirs. The syntax is CONDA_ENVS_PATH=path/to/desired/pkgs/dir:path/to/other/desired/pkgs/dir on Linux/macOS and set CONDA_ENVS_PATH=path/to/desired/pkgs/dir;path/to/other/desired/pkgs/dir on Windows.
  • Use the --prefix (or -p for short) option when creating your conda environment: conda create -n myEnv --prefix path/to/desired/envs/dir
Reaves answered 17/6 at 22:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.