conda icon indicating copy to clipboard operation
conda copied to clipboard

Conda gets stuck / hangs at "Collecting package metadata (current_repodata.json)" using create or install or update

Open dasupradyumna opened this issue 3 years ago • 15 comments

Checklist

  • [x] I added a descriptive title
  • [X] I searched open reports and couldn't find a duplicate

What happened?

Conda does not move past the "Collecting package metadata (current_repodata.json) : " stage when I run the command with options such as create, install or update. I have left it running for a few hours, so I presume it is stuck in an infinite loop somewhere(?).

I have been using conda for a while now, and this issue has popped up recently when I tried to create a new environment. I have uninstalled and freshly installed miniconda3 (PY3.9), yet the issue persists. I have cleaned up all conda files before reinstalling as is stated in the official documentation.

So, I am not sure what suddenly caused this issue. Thanks in advance for the help.

Conda Info

active environment : base
    active env location : /home/kenja/miniconda3
            shell level : 1
       user config file : /home/kenja/.condarc
 populated config files : /home/kenja/.condarc
          conda version : 4.12.0
    conda-build version : not installed
         python version : 3.9.12.final.0
       virtual packages : __cuda=11.6=0
                          __linux=5.15.0=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/kenja/miniconda3  (writable)
      conda av data dir : /home/kenja/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/kenja/miniconda3/pkgs
                          /home/kenja/.conda/pkgs
       envs directories : /home/kenja/miniconda3/envs
                          /home/kenja/.conda/envs
               platform : linux-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.12 Linux/5.15.0-46-generic ubuntu/20.04.4 glibc/2.31
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

Conda Config

==> /home/kenja/.condarc <==
auto_activate_base: False

Conda list

# packages in environment at /home/kenja/miniconda3:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    defaults
_openmp_mutex             4.5                       1_gnu    defaults
brotlipy                  0.7.0           py39h27cfd23_1003    defaults
ca-certificates           2022.3.29            h06a4308_1    defaults
certifi                   2021.10.8        py39h06a4308_2    defaults
cffi                      1.15.0           py39hd667e15_1    defaults
charset-normalizer        2.0.4              pyhd3eb1b0_0    defaults
colorama                  0.4.4              pyhd3eb1b0_0    defaults
conda                     4.12.0           py39h06a4308_0    defaults
conda-content-trust       0.1.1              pyhd3eb1b0_0    defaults
conda-package-handling    1.8.1            py39h7f8727e_0    defaults
cryptography              36.0.0           py39h9ce1e76_0    defaults
idna                      3.3                pyhd3eb1b0_0    defaults
ld_impl_linux-64          2.35.1               h7274673_9    defaults
libffi                    3.3                  he6710b0_2    defaults
libgcc-ng                 9.3.0               h5101ec6_17    defaults
libgomp                   9.3.0               h5101ec6_17    defaults
libstdcxx-ng              9.3.0               hd4cf53a_17    defaults
ncurses                   6.3                  h7f8727e_2    defaults
openssl                   1.1.1n               h7f8727e_0    defaults
pip                       21.2.4           py39h06a4308_0    defaults
pycosat                   0.6.3            py39h27cfd23_0    defaults
pycparser                 2.21               pyhd3eb1b0_0    defaults
pyopenssl                 22.0.0             pyhd3eb1b0_0    defaults
pysocks                   1.7.1            py39h06a4308_0    defaults
python                    3.9.12               h12debd9_0    defaults
readline                  8.1.2                h7f8727e_1    defaults
requests                  2.27.1             pyhd3eb1b0_0    defaults
ruamel_yaml               0.15.100         py39h27cfd23_0    defaults
setuptools                61.2.0           py39h06a4308_0    defaults
six                       1.16.0             pyhd3eb1b0_1    defaults
sqlite                    3.38.2               hc218d9a_0    defaults
tk                        8.6.11               h1ccaba5_0    defaults
tqdm                      4.63.0             pyhd3eb1b0_0    defaults
tzdata                    2022a                hda174b7_0    defaults
urllib3                   1.26.8             pyhd3eb1b0_0    defaults
wheel                     0.37.1             pyhd3eb1b0_0    defaults
xz                        5.2.5                h7b6447c_0    defaults
yaml                      0.2.5                h7b6447c_0    defaults
zlib                      1.2.12               h7f8727e_1    defaults

Additional Context

conda_update conda_install conda_create_python In above three cases, the process is stuck at Collecting package metadata stage as mentioned previously.

conda_create_nodeps In this last case, it is stuck after Solving environment stage. Please note no new environment or library were successfully installed in any case as none of the above 4 processes ended.

But, when I tried to kill the process using Ctrl+Z, the output was the same in all 4 cases -

conda_force_kill

dasupradyumna avatar Aug 21 '22 12:08 dasupradyumna

I can think of several things to try and see if we can get more info.

  • Enable verbosity with either -vvv or setting CONDA_VERBOSITY=3 and let's see if we can infer where it's getting stuck (fetching, loading or post-processing)
  • Try skipping current_repodata.json by adding the flag --repodata-fn=repodata.json
  • conda clean --all to remove all index caches
  • Use the --offline flag to see if the error comes from network issues.

Let us know!

jaimergp avatar Aug 22 '22 12:08 jaimergp

@dasupradyumna did you manage to get past this?

@jaimergp I tried all the steps you mentioned, skipping repodata, conda clean --all, the --offline flag... all result in the below.

This is my output after about 15 minutes, i.e. same as output at 3s:

root@e0a380ae66c9:/sd# conda env create -vvv -f environment.yaml 
DEBUG conda.gateways.logging:set_verbosity(246): verbosity set to 3
DEBUG conda.core.solve:solve_final_state(258): solving prefix /opt/conda/envs/ldm
  specs_to_remove: frozenset()
  specs_to_add: frozenset({MatchSpec("cudatoolkit=11.3"), MatchSpec("pip=20.3"), MatchSpec("numpy=1.19.2"), MatchSpec("torchvision=0.12.0"), MatchSpec("python=3.8.5"), MatchSpec("pytorch=1.11.0"), MatchSpec("git")})
  prune: False
Collecting package metadata (repodata.json): ...working... 

Hoping for some help.

webel avatar Sep 04 '22 13:09 webel

Sorry for disappearing, it was an important machine for running processes, but no stored data. So, I just uninstalled and reinstalled a fresh Ubuntu OS. Now, conda works as expected. I will leave this issue open since @webel seems to be still facing the same issue, and I presume a few others might be too. If not, I will close it.

dasupradyumna avatar Sep 29 '22 05:09 dasupradyumna

Hi, I’m having the same bug here (exact same output, reproduced skipping repodata, conda clean --all, the --offline flag etc.), if you need more input on this.

A bit more info: I tried running it in pdb, and then Ctrl-C’ing to see where exactly it hangs, but it is totally unresponsive to Ctrl-C. had to kill it

EDIT: weirdly, trying to reinstall conda in another directory (through the Miniconda3-latest-Linux-x86_64.sh install script) hangs at the exact same step (Collecting package metadata (repodata.json))

EDIT 2: I’m on ubuntu like OP (18.04.5 LTS)

tbrugere avatar Oct 06 '22 03:10 tbrugere

Can you post your verbose logs? Add -vvv to your command.

jaimergp avatar Oct 06 '22 15:10 jaimergp

$ CONDA_VERBOSITY=3 conda create  --name test
DEBUG conda.gateways.logging:set_verbosity(236): verbosity set to 3
DEBUG conda.core.solve:solve_final_state(258): solving prefix /home/tristan/miniconda3/envs/te
st
  specs_to_remove: frozenset()
  specs_to_add: frozenset()
  prune: Null
Collecting package metadata (current_repodata.json): ...working... ^Z
[1]+  Stopped                 ( __add_sys_prefix_to_path; "$CONDA_EXE" $_CE_M $_CE_CONDA "$@" 
)
$ kill %1
$ CONDA_VERBOSITY=3 conda create  --name test --repodata-fn=repodat
a.json --offline                                                                              
DEBUG conda.gateways.logging:set_verbosity(236): verbosity set to 3                           
DEBUG conda.core.solve:solve_final_state(258): solving prefix /home/tristan/miniconda3/envs/te
st                                                                                            
  specs_to_remove: frozenset()                                                                
  specs_to_add: frozenset()                                                                   
  prune: Null                                                                                 
Collecting package metadata (repodata.json): ...working... ^Z                                 
[1]+  Stopped                 ( __add_sys_prefix_to_path; "$CONDA_EXE" $_CE_M $_CE_CONDA "$@" 
)                                                                                             

Were the logs for that. But I’m ashamed to say that a system update (apt update / apt upgrade) and a reboot fixed it (should have tried it at first).

Still a mystery why this happened though, but i feel this is not a problem with conda, but with one of the things conda calls...

tbrugere avatar Oct 06 '22 18:10 tbrugere

I had this error when I was working on a cluster, I forget to add CPU/GPU when i was creating the environment. See if you have enough ram when installing using conda.

prk9009 avatar Mar 15 '23 19:03 prk9009

Facing exactly this. It just gets stuck after "being done".

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate vidgen
#
# To deactivate an active environment, use
#
#     $ conda deactivate

prompt is not returned, one core at 100%:

sadmin      1486  100  0.0 185544 52360 pts/0    R    13:11   9:35 /home/sadmin/miniconda3/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=8) --multiprocessing-fork
sadmin      3647  0.0  0.0  16260 10628 pts/0    S    13:18   0:00 /home/sadmin/miniconda3/bin/python -c from multiprocessing.resource_tracker import main;main(5)
sadmin      3648  0.1  0.0 185976 51488 pts/0    D    13:18   0:00 /home/sadmin/miniconda3/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=8) --multiprocessing-fork
sadmin      3744  2.2  0.1 739208 180544 pts/0   S+   13:18   0:03 /home/sadmin/miniconda3/bin/python /home/sadmin/miniconda3/bin/conda create -n vidgen python=3.9
sadmin      3746  0.0  0.0  16260 10704 pts/0    S+   13:18   0:00 /home/sadmin/miniconda3/bin/python -c from multiprocessing.resource_tracker import main;main(5)
sadmin      3747  0.1  0.0 185976 51352 pts/0    D+   13:18   0:00 /home/sadmin/miniconda3/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=8) --multiprocessing-fork

16 cores of ryzen, 96GB ram, 1gb of ram used... Completely fresh, new installation of ubuntu server 22.04.

If killed, this is the trace:

^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/sadmin/miniconda3/lib/python3.9/multiprocessing/popen_fork.py", line 27, in poll
    pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt

It gets stuck REALLY HARD:

image

ThatCoffeeGuy avatar Apr 07 '23 13:04 ThatCoffeeGuy

A new ubuntu install, using the very same installer and basically doing everything the same way - works perfectly.

The only difference here, is that the nvidia drivers are not installed yet.

This remains a big mystery.

ThatCoffeeGuy avatar Apr 07 '23 14:04 ThatCoffeeGuy

After an hour of using it and installing torch, cuda stuff, eventually it stops working.

ThatCoffeeGuy avatar Apr 07 '23 15:04 ThatCoffeeGuy

trace of the sudden death:


rmdir("/home/sadmin/miniconda3/envs/textgen/.condatmp") = 0
openat(AT_FDCWD, "/home/sadmin/miniconda3/envs/textgen/.condatmp", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
lstat("/home/sadmin/miniconda3/envs/textgen/.condatmp", 0x7ffd2fec82a0) = -1 ENOENT (No such file or directory)
stat("/home/sadmin/miniconda3/envs/textgen/.condatmp", 0x7ffd2fec82a0) = -1 ENOENT (No such file or directory)
write(1, "#\n# To activate this environment"..., 143#
# To activate this environment, use
#
#     $ conda activate textgen
#
# To deactivate an active environment, use
#
#     $ conda deactivate
) = 143
write(1, "\n", 1
)                       = 1
wait4(6907, 0x7ffd2fec9554, WNOHANG, NULL) = 0
kill(6907, SIGTERM)                     = 0
wait4(6907, 0x7ffd2fec9554, WNOHANG, NULL) = 0
getpid()                                = 6896
wait4(6907,



ThatCoffeeGuy avatar Apr 07 '23 17:04 ThatCoffeeGuy

I have no idea how is it related, in my case, the issue was a device (RTX 3090) not connecting properly via PCI passthrough. Absolutely no idea how is it related, but once I fixed that (or removed the device) the hang and 100% CPU core usage in kernel space stopped.

ThatCoffeeGuy avatar Apr 08 '23 10:04 ThatCoffeeGuy

Hey @ThatCoffeeGuy, this is probably related to the CUDA detection plugin. If you can reproduce again, try if CONDA_OVERRIDE_CUDA=10 changes anything.

jaimergp avatar Apr 11 '23 08:04 jaimergp

I think I got a very similar situation as you described, the only difference is I got AttributeError: 'Namespace' object has no attribute 'func' when running conda -vvv. I didn't solve the problem yet

hfl112 avatar Oct 22 '23 16:10 hfl112