alan ocallaghan
alan ocallaghan

Reputation: 3038

conda hangs indefinitely when installing/activating R

Some time yesterday I started having issues with (mini)conda and environments containing R. Basically installing R into an environment, or activating an environment containing r-base (or some dependency thereof) reproducibly causes the conda process to completely freeze the terminal. Ctrl+c does nothing, hitting enter doesn't even create newlines. It's completely frozen.

The following reproduces the error for me:

conda create -n r-env r-base
conda activate r-env

This just hangs indefinitely (or at least it lasted overnight with no change).

conda hanging in my console after trying to run "conda activate r-env"

I've already tried removing conda and reinstalling it, and removing most of my environments.

...any ideas?

edit: Somehow it's conda-forge's version of r-base that does this... Removing it from the list of channels in my condarc means this no longer hangs. Strange thing is that conda-forge's r-base was last updated 7 days ago and I've not had issues until yesterday.

Upvotes: 3

Views: 450

Answers (1)

merv
merv

Reputation: 77098

Debugging Conda Activation

Conda activation is primarily about managing environment variables in shell session. For POSIX shells, the core of what gets run can be viewed using

# need to use the actual binary `conda` 
~/miniconda3/condabin/conda shell.posix activate r-env

For me, this shows several Conda-specific environment variables being set, plus four activation scripts associated with the packages:

  • gfortran_osx-64
  • r-base
  • clang_osx-64
  • clangxx_osx-64

I would try running each of these in sequence to find where things are getting stuck.

It may also be useful to point out the set -x command for BASH, to trace all the commands getting run. E.g., one might try something like:

set -x && . ~/miniconda3/envs/r-env/etc/conda/activate.d/activate-r-base.sh && set +x

to trace through that particular activation script.

Other Conda Activation Notes

One can view the BASH source for conda activate with:

type conda
type __conda_activate

But this is unlikely where the issue is happening, since this appears particular to the environment with conda-forge::r-base installed.

Upvotes: 1

Related Questions