Skip to content

vscode activates conda but points to the default python #4434

@Casyfill

Description

@Casyfill

Environment data

  • VS Code version: 1.31.1 (1.31.1)
  • Extension version (available under the Extensions sidebar): 2019.1.0
  • OS and version: MacOS 10.14.3 (18D42)
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.6, conda 4.6.4
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda

Expected behavior

when conda activate env, anaconda's python is used. this works in the shell terminal

Actual behavior

when conda activate env, terminal states that env is activated - prints (env) at the beginning of the line. Same with the interpreter - VScode sees it and I am able to select it.

However, which python points to the default python on MacOS, and therefore none python 3.6-dependent packages work. Same with the interpreter - VScode fails to find packages which are installed in the env

Steps to reproduce:

  1. conda env create -n py36 python=3.6 luigi
  2. conda activate py36
  3. which python // in vscode terminal

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

___________________ ERROR collecting tests/test_reporter.py ____________________
ImportError while importing test module '/Users/philippk/Dropbox/se_projects/4_Automation/SERJ/tests/test_reporter.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test_reporter.py:5: in <module>
    from SE.areas import get_all_areas
E   ModuleNotFoundError: No module named 'SE'
!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!

PROBLEMS similarly complains about lack of packages installed and type hints.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

(base) ZG00021:SERJ philippk$ conda activate py36
(py36) ZG00021:SERJ philippk$ which python
/usr/local/bin/python
(py36) ZG00021:SERJ philippk$ conda --version
conda 4.6.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions