Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conda run while another environment is active produces weird PATH behavior #11343

Closed
justin-f-perez opened this issue Mar 16, 2022 · 3 comments
Closed
Labels
duplicate indicate issues/PRs that are duplicates of another locked [bot] locked due to inactivity source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type

Comments

@justin-f-perez
Copy link

justin-f-perez commented Mar 16, 2022

What happened?

A script that prints each command before running it:

#!/bin/zsh -i
# NOTE: `-i` is required, otherwise conda barfs a misleading error telling you to `conda init`
echo '$ which pip' && which pip
echo '$ conda activate ai.py3' && conda activate ai.py3
echo '$ which pip' && which pip
echo '$ conda run -n ai.py3 which pip3' && conda run -n ai.py3 which pip3

The output of the above script

❯ ./snaketivate.sh
$ which pip
/opt/homebrew/bin/pip
$ conda activate ai.py3
$ which pip
/opt/homebrew/Caskroom/miniconda/base/envs/ai.py3/bin/pip
$ conda run -n ai.py3 which pip3
/opt/homebrew/Caskroom/miniconda/base/bin/pip3

That last line is wrong. Clearly it should be /opt/homebrew/Caskroom/miniconda/base/envs/ai.py3/bin/pip. The combination of having the environment active and attempting to run a command inside of the same environment leads to... no environment?

Conda info

conda info
❯ conda info | sed 's/myrealusername/condauser/g'
     active environment : None
            shell level : 0
       user config file : /Users/condauser/.condarc
 populated config files : /Users/condauser/.condarc
          conda version : 4.12.0
    conda-build version : not installed
         python version : 3.8.11.final.0
       virtual packages : __osx=11.6.2=0
                          __unix=0=0
                          __archspec=1=arm64
       base environment : /opt/homebrew/Caskroom/miniconda/base  (writable)
      conda av data dir : /opt/homebrew/Caskroom/miniconda/base/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /opt/homebrew/Caskroom/miniconda/base/pkgs
                          /Users/condauser/.conda/pkgs
       envs directories : /opt/homebrew/Caskroom/miniconda/base/envs
                          /Users/condauser/.conda/envs
               platform : osx-arm64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.8.11 Darwin/20.6.0 OSX/11.6.2
                UID:GID : 441011056:5000473
             netrc file : None
           offline mode : False

❯ conda activate ai.py3
❯ conda info | sed 's/myrealusername/condauser/g'

     active environment : ai.py3
    active env location : /opt/homebrew/Caskroom/miniconda/base/envs/ai.py3
            shell level : 1
       user config file : /Users/condauser/.condarc
 populated config files : /Users/condauser/.condarc
          conda version : 4.12.0
    conda-build version : not installed
         python version : 3.8.11.final.0
       virtual packages : __osx=11.6.2=0
                          __unix=0=0
                          __archspec=1=arm64
       base environment : /opt/homebrew/Caskroom/miniconda/base  (writable)
      conda av data dir : /opt/homebrew/Caskroom/miniconda/base/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /opt/homebrew/Caskroom/miniconda/base/pkgs
                          /Users/condauser/.conda/pkgs
       envs directories : /opt/homebrew/Caskroom/miniconda/base/envs
                          /Users/condauser/.conda/envs
               platform : osx-arm64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.8.11 Darwin/20.6.0 OSX/11.6.2
                UID:GID : 441011056:5000473
             netrc file : None
           offline mode : False

Conda config

conda config
❯ conda config --show-sources
==> /Users/condauser/.condarc <==
auto_activate_base: False
channels:
  - conda-forge
  - defaults
report_errors: False
unsatisfiable_hints: True

Conda list

conda list
❯ conda list --show-channel-urls
# packages in environment at /opt/homebrew/Caskroom/miniconda/base:
#
# Name                    Version                   Build  Channel
brotlipy                  0.7.0           py38h1a28f6b_1002    defaults
ca-certificates           2022.2.1             hca03da5_0    defaults
certifi                   2021.10.8        py38hca03da5_2    defaults
cffi                      1.15.0           py38h22df2f2_1    defaults
charset-normalizer        2.0.4              pyhd3eb1b0_0    defaults
colorama                  0.4.4              pyhd3eb1b0_0    defaults
conda                     4.12.0           py38hca03da5_0    defaults
conda-package-handling    1.7.3            py38h1a28f6b_1    defaults
cryptography              36.0.0           py38h834c97f_0    defaults
idna                      3.3                pyhd3eb1b0_0    defaults
libcxx                    12.0.0               hf6beb65_1    defaults
libffi                    3.4.2                hc377ac9_2    defaults
ncurses                   6.3                  h1a28f6b_2    defaults
openssl                   1.1.1m               h1a28f6b_0    defaults
pip                       21.2.4           py38hca03da5_0    defaults
pycosat                   0.6.3            py38h1a28f6b_0    defaults
pycparser                 2.21               pyhd3eb1b0_0    defaults
pyopenssl                 22.0.0             pyhd3eb1b0_0    defaults
pysocks                   1.7.1            py38hca03da5_0    defaults
python                    3.8.11          h35b60ff_4_cpython    defaults
python.app                3                py38h1230e6a_0    defaults
readline                  8.1.2                h1a28f6b_1    defaults
requests                  2.27.1             pyhd3eb1b0_0    defaults
ruamel_yaml               0.15.100         py38h1a28f6b_0    defaults
setuptools                58.0.4           py38hca03da5_1    defaults
six                       1.16.0             pyhd3eb1b0_1    defaults
sqlite                    3.38.0               h1058600_0    defaults
tk                        8.6.11               hb8d0fd4_0    defaults
tqdm                      4.63.0             pyhd3eb1b0_0    defaults
urllib3                   1.26.8             pyhd3eb1b0_0    defaults
wheel                     0.37.1             pyhd3eb1b0_0    defaults
xz                        5.2.5                h1a28f6b_0    defaults
yaml                      0.2.5                h1a28f6b_0    defaults
zlib                      1.2.11               h5a0b063_4    defaults

❯ conda activate ai.py3
❯ conda list --show-channel-urls
# packages in environment at /opt/homebrew/Caskroom/miniconda/base/envs/ai.py3:
#
# Name                    Version                   Build  Channel
appnope                   0.1.2           py310h2ec42d9_2    conda-forge
argh                      0.26.2          pyh9f0ad1d_1002    conda-forge
asttokens                 2.0.5              pyhd8ed1ab_0    conda-forge
attrs                     21.4.0             pyhd8ed1ab_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
black                     21.12b0            pyhd8ed1ab_0    conda-forge
bzip2                     1.0.8                h0d85af4_4    conda-forge
ca-certificates           2021.10.8            h033912b_0    conda-forge
click                     8.0.4           py310h2ec42d9_0    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
docopt                    0.6.2                      py_1    conda-forge
executing                 0.8.3              pyhd8ed1ab_0    conda-forge
fzf                       0.29.0               h990441c_0    conda-forge
iniconfig                 1.1.1              pyh9f0ad1d_0    conda-forge
ipython                   8.1.1           py310h2ec42d9_0    conda-forge
jedi                      0.18.1          py310h2ec42d9_0    conda-forge
libffi                    3.4.2                h0d85af4_5    conda-forge
libzlib                   1.2.11            h9173be1_1013    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
mypy                      0.931           py310he24745e_2    conda-forge
mypy_extensions           0.4.3           py310h2ec42d9_4    conda-forge
ncurses                   6.3                  he49afe7_0    conda-forge
openssl                   3.0.0                h0d85af4_2    conda-forge
packaging                 21.3               pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pathspec                  0.9.0              pyhd8ed1ab_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       22.0.3             pyhd8ed1ab_0    conda-forge
platformdirs              2.5.1              pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0           py310h2ec42d9_2    conda-forge
prompt-toolkit            3.0.27             pyha770c72_0    conda-forge
psutil                    5.9.0           py310he24745e_0    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
py                        1.11.0             pyh6c4a22f_0    conda-forge
pygments                  2.11.2             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.7              pyhd8ed1ab_0    conda-forge
pytest                    7.0.1           py310h2ec42d9_0    conda-forge
pytest-watch              4.1.0           py310h2ec42d9_1003    conda-forge
python                    3.10.2          hea1dfa3_3_cpython    conda-forge
python_abi                3.10                    2_cp310    conda-forge
pyyaml                    6.0             py310he24745e_3    conda-forge
readline                  8.1                  h05e3726_0    conda-forge
setuptools                60.9.3          py310h2ec42d9_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sqlite                    3.37.0               h23a322b_0    conda-forge
stack_data                0.2.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h5dbffcc_0    conda-forge
tomli                     1.2.2              pyhd8ed1ab_0    conda-forge
traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
typed-ast                 1.5.2           py310he24745e_0    conda-forge
typing_extensions         4.1.1              pyha770c72_0    conda-forge
tzdata                    2021e                he74cb21_0    conda-forge
watchdog                  2.1.6           py310hda895ab_1    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xz                        5.2.5                haf1e3a3_1    conda-forge
yaml                      0.2.5                h0d85af4_2    conda-forge
zlib                      1.2.11            h9173be1_1013    conda-forge

Additional Context

Related: #11316

@justin-f-perez justin-f-perez added the type::bug describes erroneous operation, use severity::* to classify the type label Mar 16, 2022
@justin-f-perez
Copy link
Author

@kenodegard (if you want to add to the list)

@justin-f-perez
Copy link
Author

ahh... actually this may be related to or even a duplicate of #11174? I'm unsure.

@kenodegard kenodegard added source::community catch-all for issues filed by community members duplicate indicate issues/PRs that are duplicates of another labels Mar 17, 2022
@kenodegard
Copy link
Contributor

@justin-f-perez yup, this definitely seems to be a duplicate

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Mar 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate indicate issues/PRs that are duplicates of another locked [bot] locked due to inactivity source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type
Projects
None yet
Development

No branches or pull requests

2 participants