microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.34k stars 1.19k forks source link

Unable to access Python 3 environments in /anaconda2 #7548

Closed juliussimonelli closed 4 years ago

juliussimonelli commented 5 years ago

Issue Type: Bug

When I try to select a Python interpreter, only the Python 2 environments are appearing. I created a python 3 environment in anaconda but it is not showing up as a Python interpreter in VSCode.

When I look at my conda environments, I see:

$ conda env list
# conda environments:
#
base                     /anaconda2
python3               *  /anaconda2/envs/python3
sk                       /anaconda2/envs/sk

But when I try to select an interpreter only base, sk, and other (non conda) interpreters appear. I went into my settings.json and added:

{
    "python.pythonPath": "/anaconda2/envs/python3",
    "python.condaPath": "/anaconda2/envs/python3"
}

but the bottom left still says "Select Python Interpreter" and I cannot run the code. Restarting it did not help. Note that outside of VSCode I can run the python 3 environment and it works.

Here is the output of conda info --json

{
  "GID": 20,
  "UID": 501,
  "active_prefix": "/anaconda2/envs/python3",
  "active_prefix_name": "python3",
  "channels": [
    "https://repo.anaconda.com/pkgs/main/osx-64",
    "https://repo.anaconda.com/pkgs/main/noarch",
    "https://repo.anaconda.com/pkgs/r/osx-64",
    "https://repo.anaconda.com/pkgs/r/noarch"
  ],
  "conda_build_version": "3.18.9",
  "conda_env_version": "4.7.11",
  "conda_location": "/anaconda2/lib/python2.7/site-packages/conda",
  "conda_prefix": "/anaconda2",
  "conda_private": false,
  "conda_shlvl": 2,
  "conda_version": "4.7.11",
  "config_files": [
    "/Users/juliussimonelli/.condarc"
  ],
  "default_prefix": "/anaconda2/envs/python3",
  "env_vars": {
    "CIO_TEST": "<not set>",
    "CONDA_DEFAULT_ENV": "python3",
    "CONDA_EXE": "/anaconda2/bin/conda",
    "CONDA_PREFIX": "/anaconda2/envs/python3",
    "CONDA_PREFIX_1": "/anaconda2",
    "CONDA_PROMPT_MODIFIER": "(python3) ",
    "CONDA_PYTHONBREAKPOINT": "",
    "CONDA_PYTHON_EXE": "/anaconda2/bin/python",
    "CONDA_ROOT": "/anaconda2",
    "CONDA_SHLVL": "2",
    "PATH": "/anaconda2/bin:/anaconda3/bin:/anaconda2/envs/python3/bin:/anaconda2/condabin:/Users/juliussimonelli/anaconda2/bin:/Users/juliussimonelli/bin:/usr/local/cuda/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/juliussimonelli/.local/bin",
    "PYTHONPATH": "/Library/Python/2.7/site-packages:/Users/juliussimonelli/orbital/base/core/oicv/src/py:/Users/juliussimonelli/orbital/base/core/chameleon_client/src/py:/Users/juliussimonelli/orbital/base/core/catalog_client/src/py:/Users/juliussimonelli/orbital/base/core/oil/src/py:/Users/juliussimonelli/orbital/base/core/retail/src/py:/Users/juliussimonelli/orbital/base/core/iqt:/Users/juliussimonelli/orbital/base/core/sandbox:/Users/juliussimonelli/orbital/base/core/services/src/py:/Users/juliussimonelli/orbital/base/core/projects:/Users/juliussimonelli/orbital/base/core/OFL/src/py::/Users/juliussimonelli/orbital/base/ops/tools/libs/python-common/",
    "PYTHONUNBUFFERED": "1",
    "REQUESTS_CA_BUNDLE": "<not set>",
    "S3_ASTRIUM_REQUEST_PATH": "astrium/request",
    "S3_CHINACON_INGESTION_PATH": "china",
    "S3_IQT_INGESTION_PATH": "iqt",
    "S3_OIL_INGESTION_PATH": "oil",
    "S3_REQUEST_PATH": "aether/requests",
    "S3_RETAIL_INGESTION_PATH": "retail",
    "SSL_CERT_FILE": "<not set>"
  },
  "envs": [
    "/anaconda2",
    "/anaconda2/envs/python3",
    "/anaconda2/envs/sk"
  ],
  "envs_dirs": [
    "/anaconda2/envs",
    "/Users/juliussimonelli/.conda/envs"
  ],
  "netrc_file": null,
  "offline": false,
  "pkgs_dirs": [
    "/anaconda2/pkgs",
    "/Users/juliussimonelli/.conda/pkgs"
  ],
  "platform": "osx-64",
  "python_version": "2.7.16.final.0",
  "rc_path": "/Users/juliussimonelli/.condarc",
  "requests_version": "2.21.0",
  "root_prefix": "/anaconda2",
  "root_writable": true,
  "site_dirs": [
    "~/.local/lib/python2.7"
  ],
  "sys.executable": "/anaconda2/bin/python",
  "sys.prefix": "/anaconda2",
  "sys.version": "2.7.16 |Anaconda, Inc.| (default, Aug 22 2019, 10:59:10) \n[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]",
  "sys_rc_path": "/anaconda2/.condarc",
  "user_agent": "conda/4.7.11 requests/2.21.0 CPython/2.7.16 Darwin/18.7.0 OSX/10.14.6",
  "user_rc_path": "/Users/juliussimonelli/.condarc",
  "virtual_pkgs": []
}

Extension version: 2019.9.34911 VS Code version: Code 1.38.1 (b37e54c98e1a74ba89e03073e5a3761284e3ffb0, 2019-09-11T13:31:32.854Z) OS version: Darwin x64 18.7.0 Remote OS version: Linux x64 3.10.0-957.5.1.el7.x86_64

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz (8 x 2700)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|3, 5, 5| |Memory (System)|16.00GB (0.11GB free)| |Process Argv|-psn_0_2728602| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|SSH: localhost| |OS|Linux x64 3.10.0-957.5.1.el7.x86_64| |CPUs|Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz (4 x 2699)| |Memory (System)|59.81GB (3.36GB free)| |VM|0%|
ericsnowcurrently commented 5 years ago

@juliussimonelli, thanks for letting us know about this. I'm going to take a look at this as soon as I can.

ericsnowcurrently commented 5 years ago

The values you tried in your settings.json aren't quite right. Try using the following workspace settings:

{
    "python.pythonPath": "/anaconda2/envs/python3/bin/python",
    "python.condaPath": "/anaconda2/bin/conda"
}
juliussimonelli commented 5 years ago

I just updated it to your suggestion and it's still not working. Same error.

ericsnowcurrently commented 5 years ago

Also, is the "python3" environment one using Python 3? If so then that's probably your problem. It looks like you're using Anaconda set up for Python 2. In particular, the conda info --json output you provided shows (under "env_vars"): "PYTHONPATH": "/Library/Python/2.7/site-packages:.... That will cause problems under Python 3.

juliussimonelli commented 5 years ago

Yes, it is using Python 3. The actual conda environment works fine though. I can activate it and run Python 3 code on it with no problem.

juliussimonelli commented 5 years ago

It has its own site-packages:

$ conda activate python3
(python3) juliussimonelli on ip-10-4-15-227 @ 02:19 PM: ~
$ python -m site
sys.path = [
    '/Users/juliussimonelli',
    '/Library/Python/2.7/site-packages',
    '/anaconda2/envs/python3/lib/python37.zip',
    '/anaconda2/envs/python3/lib/python3.7',
    '/anaconda2/envs/python3/lib/python3.7/lib-dynload',
    '/anaconda2/envs/python3/lib/python3.7/site-packages',
    '/anaconda2/envs/python3/lib/python3.7/site-packages/aeosa',
]
ericsnowcurrently commented 5 years ago

When Python resolves imports, the first match under sys.path wins. In this case, anything found in /Library/Python/2.7/site-packages will be used, which may not work under Python 3.

It sounds like that isn't a problem for you, but it might impact how we invoke the interpreter when discovering the available interpreters.

What do you see in the "Python" output panel? We should see conda being invoked in various ways when looking for interpreters. For example, here's what I see (using miniconda, with several other system Pythons installed):

> conda --version
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> /usr/bin/python3.7 -c "import sys;print(sys.executable)"
> ~/miniconda3/bin/conda info --json
> ~/miniconda3/bin/conda env list
> ~/miniconda3/bin/conda env list
> ~/miniconda3/bin/conda info --json

I'd like to see what is showing up for you. It may also be useful to see the "developer tools" 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)

Note that (currently) when we invoke the interpreter from a particular conda environment, we run the executable directly, rather than using conda run .... However, I'm not sure that's related. If it is then it's something we're already working on fixing.

juliussimonelli commented 5 years ago

Here's the output from the Python panel:


Starting Microsoft Python language server.
> pyenv root
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.executable)"
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/sk/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/sk/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
Starting Jedi Python language engine.
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.prefix)"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.prefix)"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.executable)"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.executable)"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -m site --user-site
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -m site --user-site
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python completion.py
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles
> /anaconda2/envs/python3/bin/python completion.py
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles
Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message: No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/bin/python -c "import sys;print(sys.prefix)"
cwd: ~/path/to/my/code
> /anaconda2/bin/python -c "import sys;print(sys.prefix)"
cwd: ~/path/to/my/code
> /anaconda2/bin/python -c "import sys;print(sys.executable)"
cwd: ~/path/to/my/code
> /anaconda2/bin/python -c "import sys;print(sys.executable)"
cwd: ~/path/to/my/code
> /anaconda2/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/path/to/my/code
> /anaconda2/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/path/to/my/code
> /anaconda2/bin/python -m site --user-site
cwd: ~/path/to/my/code
> /anaconda2/bin/python -m site --user-site
cwd: ~/path/to/my/code
> /anaconda2/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/bin/python -m pip --version
> /anaconda2/bin/python completion.py
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles
> /anaconda2/bin/python completion.py
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.prefix)"
cwd: ~/path/to/my/code
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.prefix)"
cwd: ~/path/to/my/code
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.executable)"
cwd: ~/path/to/my/code
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.executable)"
cwd: ~/path/to/my/code
> /anaconda2/bin/python3/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/path/to/my/code
> /anaconda2/bin/python3/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/path/to/my/code
> /anaconda2/bin/python3/bin/python -m site --user-site
cwd: ~/path/to/my/code
> /anaconda2/bin/python3/bin/python -m site --user-site
cwd: ~/path/to/my/code
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.executable)"
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.executable)"
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.executable)"
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.executable)"
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.executable)"
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.executable)"
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.executable)"
> /anaconda2/bin/python3/bin/python -c "import sys;print(sys.executable)"
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.prefix)"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.prefix)"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.executable)"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.executable)"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -m site --user-site
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python -m site --user-site
cwd: ~/path/to/my/code
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python completion.py
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles
> /anaconda2/envs/python3/bin/python completion.py
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py```
juliussimonelli commented 5 years ago

Sorry, but I didn't fully follow the next part. I turned on developer tools and got the image below. I'm not clear where to run Enable source map support for extension debugging image

ericsnowcurrently commented 5 years ago

Thanks, that really helps. From the "Python" output panel the key point chronologically is the line that starts with Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message:. That corresponds with the traceback that you see in the developer console. The traceback implies that the "enum" module is bad, which makes me think that perhaps there is an enum module in /Library/Python/2.7/site-packages. Could you provide a directory listing for that directory?

Also, what happens when you invoke the problematic script directly? Try the following (copied from the logs you provided):

/anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
juliussimonelli commented 5 years ago

yep, it's an enum problem:


(python3) juliussimonelli on ip-10-4-15-227 @ 03:30 PM: /anaconda2/envs/python3/lib/python3.7/site-packages
$ /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
Traceback (most recent call last):
  File "/Users/juliussimonelli/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py", line 4, in <module>
    import json
  File "/anaconda2/envs/python3/lib/python3.7/json/__init__.py", line 106, in <module>
    from .decoder import JSONDecoder, JSONDecodeError
  File "/anaconda2/envs/python3/lib/python3.7/json/decoder.py", line 3, in <module>
    import re
  File "/anaconda2/envs/python3/lib/python3.7/re.py", line 143, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'```
ericsnowcurrently commented 5 years ago

What do you get from the following?

/anaconda2/envs/python3/bin/python -c 'import enum; print(enum.__file__)'
juliussimonelli commented 5 years ago

$ /anaconda2/envs/python3/bin/python -c 'import enum; print(enum.__file__)'
/Library/Python/2.7/site-packages/enum/__init__.py```
ericsnowcurrently commented 5 years ago

Yep, looks like that PYTHONPATH entry from Python 2 is causing problems. I was able to reproduce the problem by creating an empty "enum.py" file in /tmp/broken and running the following command:

PYTHONPATH=/tmp/broken ~/miniconda3/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py

Do you know what added /Library/Python/2.7/site-packages to your PYTHONPATH? I suspect it wasn't conda. The simplest solution to your problem is removing that entry (assuming it doesn't break anything else). I'd expect it to break any Python 3 interpreter, not just with conda. If that doesn't take care of the problem then we can investigate further.

ericsnowcurrently commented 5 years ago

FWIW, I'm fairly sure that #7425 (using conda run) will not help. conda run would have to remove that PYTHONPATH entry for you, which it does not appear to do. I manually ran PYTHONPATH=/tmp/broken conda run -n python3 python .../interpreterInfo.py and got the same failure as before. However, if your problem is solved by using conda run then we can close this issue in favor of #7425.

juliussimonelli commented 5 years ago

Yea, it looks like my .bash_profile was adding it and putting it first. I could put it last or remove it completely. I tried removing it completely with export PYTHONPATH = /everything/but/Library/Python/2.7/site-packages in a terminal in VSCode, but when I click on "Select Python Interpreter" I still don't see my python3 environment.

ericsnowcurrently commented 5 years ago

Try leaving PYTHONPATH unset.

juliussimonelli commented 5 years ago

If I unset PYTHONPATH and click on "Select Python Interpreter" I still don't see python3. If I then open a new VSCode and check my PYTHONPATH it is reset with all the previous stuff (except /Library/Python/2.7/site-packages because I removed that line from my .bash_profile). Even after unsetting them again on a new window I can't see python3.

ericsnowcurrently commented 5 years ago

What do you get for:

/anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
juliussimonelli commented 5 years ago

$ /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
{"versionInfo": [3, 7, 4, "final"], "sysPrefix": "/anaconda2/envs/python3", "version": "3.7.4 (default, Aug 13 2019, 15:17:50) \n[Clang 4.0.1 (tags/RELEASE_401/final)]", "is64Bit": true}```
ericsnowcurrently commented 5 years ago

Please get the logs again from the "Python" output panel and the developer console. Thanks!

juliussimonelli commented 5 years ago

Here's the Python output panel:

User belongs to experiment group 'DebugAdapterFactory - experiment'
Starting Microsoft Python language server.
> pyenv root
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.executable)"
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.7 ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
Starting Jedi Python language engine.
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.prefix)"
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/out/client
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.prefix)"
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/out/client
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.executable)"
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/out/client
> /anaconda2/envs/python3/bin/python -c "import sys;print(sys.executable)"
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/out/client
> /anaconda2/envs/python3/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/out/client
> /anaconda2/envs/python3/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/out/client
> /anaconda2/envs/python3/bin/python -m site --user-site
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/out/client
> /anaconda2/envs/python3/bin/python -m site --user-site
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/out/client
> /anaconda2/envs/python3/bin/python completion.py
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles
> /anaconda2/envs/python3/bin/python completion.py
cwd: ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles
Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message: No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
> /anaconda2/envs/python3/bin/python ~/.vscode/extensions/ms-python.python-2019.9.34911/pythonFiles/interpreterInfo.py
juliussimonelli commented 5 years ago

Here are the developer tools. image These were generated by starting a new VSCode window and checking that /Library/Python/2.7/site-packages isn't present (it wasn't).

joobei commented 5 years ago

I'm having the same problem in:

Version: 1.38.1 Commit: b37e54c98e1a74ba89e03073e5a3761284e3ffb0 Date: 2019-09-11T13:31:32.854Z Electron: 4.2.10 Chrome: 69.0.3497.128 Node.js: 10.11.0 V8: 6.9.427.31-electron.0 OS: Darwin x64 18.7.0

The anaconda environment is perfectly accessible through command line but vscode, despite explicitly specifying python.pythonpath cannot find it. Here's the environment in question:

jubei$ conda info

active environment : mlagents active env location : /Users/jubei/coding/anaconda3/envs/mlagents shell level : 2 user config file : /Users/jubei/.condarc populated config files : /Users/jubei/.condarc conda version : 4.7.10 conda-build version : 3.18.8 python version : 3.7.3.final.0 virtual packages : base environment : /Users/jubei/coding/anaconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /Users/jubei/coding/anaconda3/pkgs /Users/jubei/.conda/pkgs envs directories : /Users/jubei/coding/anaconda3/envs /Users/jubei/.conda/envs platform : osx-64 user-agent : conda/4.7.10 requests/2.22.0 CPython/3.7.3 Darwin/18.7.0 OSX/10.14.6 UID:GID : 501:20 netrc file : None offline mode : False

joobei commented 5 years ago

In my case the problem was a broken anaconda installation. Different environments were in different subdirectories. I have since re-installed anaconda and the problem seems to be fixed but nevertheless, given an explicit path to the environment the python plugin should have been able to load it.

ericsnowcurrently commented 5 years ago

@juliussimonelli, sorry for the long delay. Have you tried re-installing Anaconda?

Also, you mentioned that you were having the problem even though /Library/Python/2.7/site-packages was no longer present. Those logs from the developer tools console indicate the same problem (module 'enum' has no attribute 'IntFlag'). That implies that something is still broken with your PYTHONPATH.

What does /anaconda2/envs/python3/bin/python -c 'import enum; print(enum.__file__)' say now?

juliussimonelli commented 5 years ago

Right now I get:

/anaconda2/envs/python3/lib/python3.7/enum.py

although the environment might have changed since I first posted this. I should probably just reinstall Anaconda and see if that helps. I think last time I installed Anaconda2 and made python 3 environments, but this time I'll install Anaconda3 and make python2 environments.

ericsnowcurrently commented 5 years ago

@juliussimonelli, sounds good. Please let us know if you see any problems under Anaconda3. Thanks!

brettcannon commented 4 years ago

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.