Closed juliussimonelli closed 4 years ago
@juliussimonelli, thanks for letting us know about this. I'm going to take a look at this as soon as I can.
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"
}
I just updated it to your suggestion and it's still not working. Same error.
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.
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.
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',
]
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.
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```
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
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
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'```
What do you get from the following?
/anaconda2/envs/python3/bin/python -c 'import enum; print(enum.__file__)'
$ /anaconda2/envs/python3/bin/python -c 'import enum; print(enum.__file__)'
/Library/Python/2.7/site-packages/enum/__init__.py```
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.
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.
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.
Try leaving PYTHONPATH
unset.
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.
What do you get for:
/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
{"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}```
Please get the logs again from the "Python" output panel and the developer console. Thanks!
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
Here are the developer tools.
These were generated by starting a new VSCode window and checking that /Library/Python/2.7/site-packages
isn't present (it wasn't).
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
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.
@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?
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.
@juliussimonelli, sounds good. Please let us know if you see any problems under Anaconda3. Thanks!
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.
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:
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:
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
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: enabledflash_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%|