Skip to content

conda run sometimes uses python in the base environment #8450

@kevinblack100

Description

@kevinblack100

Current Behavior

Invoking conda run always seems to use the base environment's python interpreter, even if a different environment is specified.

Steps to Reproduce

(base) C:\Users\[redacted]>conda create --name test_py36 --yes python=3.6
Collecting package metadata: done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\[redacted]\miniconda\envs\test_py36

  added / updated specs:
    - python=3.6


The following NEW packages will be INSTALLED:

  certifi            pkgs/main/win-64::certifi-2019.3.9-py36_0
  pip                pkgs/main/win-64::pip-19.0.3-py36_0
  python             pkgs/main/win-64::python-3.6.8-h9f7ef89_7
  setuptools         pkgs/main/win-64::setuptools-40.8.0-py36_0
  sqlite             pkgs/main/win-64::sqlite-3.27.2-he774522_0
  vc                 pkgs/main/win-64::vc-14.1-h0510ff6_4
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.15.26706-h3a45250_0
  wheel              pkgs/main/win-64::wheel-0.33.1-py36_0
  wincertstore       pkgs/main/win-64::wincertstore-0.2-py36h7fe50ca_0


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


(base) C:\Users\[redacted]>conda run --name test_py36 python --version
Python 3.7.1

(base) C:\Users\[redacted]>conda run --name test_py36 where python
C:\Users\[redacted]\miniconda\python.exe

Expected Behavior

conda run -n <env> python ... should use the python interpreter in the specified conda environment, not the python interpreter in the base environment.

Environment Information

`conda info`


     active environment : base
    active env location : C:\Users\[redacted]\miniconda
            shell level : 1
       user config file : C:\Users\[redacted]\.condarc
 populated config files : C:\Users\[redacted]\.condarc
          conda version : 4.6.8
    conda-build version : not installed
         python version : 3.7.1.final.0
       base environment : C:\Users\[redacted]\miniconda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\[redacted]\miniconda\pkgs
                          C:\Users\[redacted]\.conda\pkgs
                          C:\Users\[redacted]\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\[redacted]\a_apps\miniconda\envs
                          C:\Users\[redacted]\.conda\envs
                          C:\Users\[redacted]\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.6.8 requests/2.21.0 CPython/3.7.1 Windows/10 Windows/10.0.16299
          administrator : False
             netrc file : None
           offline mode : False

`conda config --show-sources`

==> C:\Users\[redacted]\.condarc <==
ssl_verify: True
channels:
  - defaults

`conda list --show-channel-urls`

# packages in environment at C:\Users\[redacted]\miniconda:
#
# Name                    Version                   Build  Channel
asn1crypto                0.24.0                   py37_0    defaults
ca-certificates           2019.1.23                     0    defaults
certifi                   2019.3.9                 py37_0    defaults
cffi                      1.11.5           py37h74b6da3_1    defaults
chardet                   3.0.4                    py37_1    defaults
conda                     4.6.8                    py37_0    defaults
conda-env                 2.6.0                         1    defaults
console_shortcut          0.1.1                         3    defaults
cryptography              2.4.2            py37h7a1dbc1_0    defaults
idna                      2.8                      py37_0    defaults
menuinst                  1.4.14           py37hfa6e2cd_0    defaults
openssl                   1.1.1b               he774522_1    defaults
pip                       18.1                     py37_0    defaults
pycosat                   0.6.3            py37hfa6e2cd_0    defaults
pycparser                 2.19                     py37_0    defaults
pyopenssl                 18.0.0                   py37_0    defaults
pysocks                   1.6.8                    py37_0    defaults
python                    3.7.1                h8c8aaf0_6    defaults
pywin32                   223              py37hfa6e2cd_1    defaults
requests                  2.21.0                   py37_0    defaults
ruamel_yaml               0.15.46          py37hfa6e2cd_0    defaults
setuptools                40.6.3                   py37_0    defaults
six                       1.12.0                   py37_0    defaults
sqlite                    3.26.0               he774522_0    defaults
urllib3                   1.24.1                   py37_0    defaults
vc                        14.1                 h0510ff6_4    defaults
vs2015_runtime            14.15.26706          h3a45250_0    defaults
wheel                     0.32.3                   py37_0    defaults
win_inet_pton             1.0.1                    py37_1    defaults
wincertstore              0.2                      py37_0    defaults
yaml                      0.1.7                hc54c509_2    defaults

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogissue has been triaged but has not been earmarked for any upcoming releaseduplicateindicate issues/PRs that are duplicates of anotherlocked[bot] locked due to inactivityos::windowsrelevant to Windowssource::communitycatch-all for issues filed by community members

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions