Why does the conda setting `auto_activate_base` change $PATH for `conda run`?

Viewed 658

I'm using conda run -n my-env python -m ipykernel install to install a new kernel in a conda environment as described here. Now i've noticed that this does not work when auto_activate_base is set to false because in this case, the bin directory of the kernel is only placed after /opt/conda/bin, so effectively the system conda python is preferred over the kernel's.

This can be seen clearly here:

$ conda config --set auto_activate_base true 
$ conda run -n fiona-env bash -c 'echo $PATH; which python'
/opt/conda/envs/fiona-env/bin:/opt/conda/bin:/opt/conda/condabin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/opt/conda/envs/fiona-env

$ conda config --set auto_activate_base false
$ conda run -n fiona-env bash -c 'echo $PATH; which python'
/opt/conda/bin:/opt/conda/envs/fiona-env/bin:/opt/conda/condabin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/opt/conda/bin/python

This is the output of conda info

     active environment : eurodatacube-0.21.2
    active env location : /opt/conda/envs/eurodatacube-0.21.2
            shell level : 1
       user config file : /home/jovyan/.condarc
 populated config files : /opt/conda/.condarc
                          /home/jovyan/.condarc
          conda version : 4.8.2
    conda-build version : not installed
         python version : 3.7.6.final.0
       virtual packages : __glibc=2.27
       base environment : /opt/conda  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          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 : /opt/conda/pkgs
                          /home/jovyan/.conda/pkgs
       envs directories : /opt/conda/envs
                          /home/jovyan/.conda/envs
               platform : linux-64
             user-agent : conda/4.8.2 requests/2.24.0 CPython/3.7.6 Linux/4.14.177-139.253.amzn2.x86_64 ubuntu/18.04.4 glibc/2.27
                UID:GID : 1000:0
             netrc file : None
           offline mode : False

Is this a bug or am I somehow using conda run in a wrong way?

0 Answers
Related