Closed enkeyz closed 3 years ago
Those are the Python extension's output log, can you provide trace logs from the language server output?
https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#filing-an-issue
Those are the Python extension's output log, can you provide trace logs from the language server output?
https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#filing-an-issue
Updated. And looks like I found the issue: [Error - 8:38:49 PM] stubPath /home/enkeyz/stuff/python/python_game/typings is not a valid directory.
Looks like it searching stubs in the wrong directory.
That message isn't important, it's always printed if the folder does not exist.
I can see in the logs that it is loading pygame from site-packages for the interpreter you've selected:
[BG(1)] parsing: /home/enkeyz/.local/share/virtualenvs/python_game-6swduDmr/lib/python3.9/site-packages/pygame/__init__.pyi [fs read 7ms] (49ms)
[BG(1)] binding: /home/enkeyz/.local/share/virtualenvs/python_game-6swduDmr/lib/python3.9/site-packages/pygame/__init__.pyi ...
[BG(1)] parsing: /home/enkeyz/.local/share/virtualenvs/python_game-6swduDmr/lib/python3.9/site-packages/pygame/constants.pyi [fs read 0ms] (8ms)
[BG(1)] binding: /home/enkeyz/.local/share/virtualenvs/python_game-6swduDmr/lib/python3.9/site-packages/pygame/constants.pyi (6ms)
[BG(1)] binding: /home/enkeyz/.local/share/virtualenvs/python_game-6swduDmr/lib/python3.9/site-packages/pygame/__init__.pyi (16ms)
So I'm a bit confused as to why we're showing an import resolution warning.
So am I. It's interesting that before installing pygame, the autocompletion and semantic highlighting worked, but after I installed it, it stopped working(both in global and in venv).
I could use Jedi server, but that doesn't provide semantic colors sadly.
In /home/enkeyz/.local/share/virtualenvs/python_game-6swduDmr/lib/python3.9/site-packages/pygame
, do you see files that aren't pyi
? What is in that folder?
We bundle some hand-written stubs for pygame, but it looks like pygame now includes some, and those take precedence. It's possible ours were of a higher quality and the ones they include are missing some things.
Ah, I missed the fact that previously, you got info but an import warning, but then installing pygame removed the warning, but then the completion was poor. This makes sense, as we are picking pygame's own stuff instead. It's also claiming to be py.typed
.
I don't see __init__.py
in that screenshot. Is there any chance you could just provide the output of ls -la
in that folder or similar to get the full listing?
Sure.
-rwxr-xr-x 1 enkeyz enkeyz 47216 febr 9 16.36 base.cpython-39-x86_64-linux-gnu.so
-rwxr-xr-x 1 enkeyz enkeyz 30312 febr 9 16.36 bufferproxy.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 363 febr 9 16.36 bufferproxy.pyi
-rwxr-xr-x 1 enkeyz enkeyz 84264 febr 9 16.36 _camera.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 2035 febr 9 16.36 _camera_opencv_highgui.py
-rw-r--r-- 1 enkeyz enkeyz 2852 febr 9 16.36 camera.py
-rw-r--r-- 1 enkeyz enkeyz 865 febr 9 16.36 camera.pyi
-rw-r--r-- 1 enkeyz enkeyz 3432 febr 9 16.36 _camera_vidcapture.py
-rwxr-xr-x 1 enkeyz enkeyz 59368 febr 9 16.36 color.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 25531 febr 9 16.36 colordict.py
-rw-r--r-- 1 enkeyz enkeyz 1490 febr 9 16.36 color.pyi
-rw-r--r-- 1 enkeyz enkeyz 3112 febr 9 16.36 compat.py
-rwxr-xr-x 1 enkeyz enkeyz 62384 febr 9 16.36 constants.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 9853 febr 9 16.36 constants.pyi
-rw-r--r-- 1 enkeyz enkeyz 14318 febr 9 16.36 cursors.py
-rw-r--r-- 1 enkeyz enkeyz 1655 febr 9 16.36 cursors.pyi
-rwxr-xr-x 1 enkeyz enkeyz 69104 febr 9 16.36 display.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 2675 febr 9 16.36 display.pyi
drwxr-xr-x 3 enkeyz enkeyz 4096 febr 9 16.36 docs
-rwxr-xr-x 1 enkeyz enkeyz 79392 febr 9 16.36 draw.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 2364 febr 9 16.36 draw.pyi
-rw-r--r-- 1 enkeyz enkeyz 19861 febr 9 16.36 draw_py.py
-rw-r--r-- 1 enkeyz enkeyz 754 febr 9 16.36 _dummybackend.py
-rwxr-xr-x 1 enkeyz enkeyz 72072 febr 9 16.36 event.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 1109 febr 9 16.36 event.pyi
drwxr-xr-x 4 enkeyz enkeyz 4096 febr 9 16.36 examples
-rwxr-xr-x 1 enkeyz enkeyz 26224 febr 9 16.36 fastevent.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 248 febr 9 16.36 fastevent.pyi
-rwxr-xr-x 1 enkeyz enkeyz 45456 febr 9 16.36 font.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 1771 febr 9 16.36 font.pyi
-rw-r--r-- 1 enkeyz enkeyz 98600 febr 9 16.36 freesansbold.ttf
-rwxr-xr-x 1 enkeyz enkeyz 131168 febr 9 16.36 _freetype.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 2264 febr 9 16.36 freetype.py
-rw-r--r-- 1 enkeyz enkeyz 3725 febr 9 16.36 freetype.pyi
-rw-r--r-- 1 enkeyz enkeyz 6284 febr 9 16.36 ftfont.py
-rwxr-xr-x 1 enkeyz enkeyz 84208 febr 9 16.36 gfxdraw.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 3026 febr 9 16.36 gfxdraw.pyi
-rwxr-xr-x 1 enkeyz enkeyz 42792 febr 9 16.36 image.cpython-39-x86_64-linux-gnu.so
-rwxr-xr-x 1 enkeyz enkeyz 51496 febr 9 16.36 imageext.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 1309 febr 9 16.36 image.pyi
-rw-r--r-- 1 enkeyz enkeyz 10348 febr 9 16.36 __init__.py
-rw-r--r-- 1 enkeyz enkeyz 1930 febr 9 16.36 __init__.pyi
-rwxr-xr-x 1 enkeyz enkeyz 34624 febr 9 16.36 joystick.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 885 febr 9 16.36 joystick.pyi
-rwxr-xr-x 1 enkeyz enkeyz 42576 febr 9 16.36 key.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 901 febr 9 16.36 key.pyi
-rw-r--r-- 1 enkeyz enkeyz 11583 febr 9 16.36 locals.py
-rw-r--r-- 1 enkeyz enkeyz 785 febr 9 16.36 macosx.py
-rwxr-xr-x 1 enkeyz enkeyz 79848 febr 9 16.36 mask.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 3149 febr 9 16.36 mask.pyi
-rwxr-xr-x 1 enkeyz enkeyz 100176 febr 9 16.36 math.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 9427 febr 9 16.36 math.pyi
-rw-r--r-- 1 enkeyz enkeyz 24875 febr 9 16.36 midi.py
-rw-r--r-- 1 enkeyz enkeyz 2001 febr 9 16.36 midi.pyi
-rwxr-xr-x 1 enkeyz enkeyz 64088 febr 9 16.36 mixer.cpython-39-x86_64-linux-gnu.so
-rwxr-xr-x 1 enkeyz enkeyz 36240 febr 9 16.36 mixer_music.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 2775 febr 9 16.36 mixer.pyi
-rwxr-xr-x 1 enkeyz enkeyz 30440 febr 9 16.36 mouse.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 1063 febr 9 16.36 mouse.pyi
-rw-r--r-- 1 enkeyz enkeyz 615 febr 9 16.36 music.pyi
-rwxr-xr-x 1 enkeyz enkeyz 34344 febr 9 16.36 newbuffer.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 2586 febr 9 16.36 _numpysndarray.py
-rw-r--r-- 1 enkeyz enkeyz 12910 febr 9 16.36 _numpysurfarray.py
-rwxr-xr-x 1 enkeyz enkeyz 59424 febr 9 16.36 pixelarray.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 1137 febr 9 16.36 pixelarray.pyi
-rwxr-xr-x 1 enkeyz enkeyz 34216 febr 9 16.36 pixelcopy.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 686 febr 9 16.36 pixelcopy.pyi
-rw-r--r-- 1 enkeyz enkeyz 2720 febr 9 16.36 pkgdata.py
drwxr-xr-x 2 enkeyz enkeyz 4096 febr 9 16.36 __pycache__
-rw-r--r-- 1 enkeyz enkeyz 145516 febr 9 16.36 pygame.ico
-rw-r--r-- 1 enkeyz enkeyz 630 febr 9 16.36 pygame_icon.bmp
-rw-r--r-- 1 enkeyz enkeyz 53627 febr 9 16.36 pygame_icon.icns
-rw-r--r-- 1 enkeyz enkeyz 15363 febr 9 16.36 pygame_icon.svg
-rw-r--r-- 1 enkeyz enkeyz 61604 febr 9 16.36 pygame_icon.tiff
drwxr-xr-x 3 enkeyz enkeyz 4096 febr 9 16.36 __pyinstaller
-rwxr-xr-x 1 enkeyz enkeyz 138440 febr 9 16.36 pypm.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 0 febr 9 16.36 py.typed
-rwxr-xr-x 1 enkeyz enkeyz 71440 febr 9 16.36 rect.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 7921 febr 9 16.36 rect.pyi
-rwxr-xr-x 1 enkeyz enkeyz 34424 febr 9 16.36 rwobject.cpython-39-x86_64-linux-gnu.so
-rwxr-xr-x 1 enkeyz enkeyz 30432 febr 9 16.36 scrap.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 312 febr 9 16.36 scrap.pyi
drwxr-xr-x 3 enkeyz enkeyz 4096 febr 9 16.36 _sdl2
-rw-r--r-- 1 enkeyz enkeyz 3860 febr 9 16.36 sndarray.py
-rw-r--r-- 1 enkeyz enkeyz 335 febr 9 16.36 sndarray.pyi
-rwxr-xr-x 1 enkeyz enkeyz 442296 febr 9 16.36 _sprite.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 61338 febr 9 16.36 sprite.py
-rw-r--r-- 1 enkeyz enkeyz 5261 febr 9 16.36 sprite.pyi
-rwxr-xr-x 1 enkeyz enkeyz 281160 febr 9 16.36 surface.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 4750 febr 9 16.36 surface.pyi
-rw-r--r-- 1 enkeyz enkeyz 12266 febr 9 16.36 surfarray.py
-rw-r--r-- 1 enkeyz enkeyz 944 febr 9 16.36 surfarray.pyi
-rwxr-xr-x 1 enkeyz enkeyz 21824 febr 9 16.36 surflock.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 15583 febr 9 16.36 sysfont.py
drwxr-xr-x 6 enkeyz enkeyz 4096 febr 9 16.36 tests
drwxr-xr-x 3 enkeyz enkeyz 4096 febr 9 16.36 threads
-rwxr-xr-x 1 enkeyz enkeyz 30328 febr 9 16.36 time.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 519 febr 9 16.36 time.pyi
-rwxr-xr-x 1 enkeyz enkeyz 80008 febr 9 16.36 transform.cpython-39-x86_64-linux-gnu.so
-rw-r--r-- 1 enkeyz enkeyz 1874 febr 9 16.36 transform.pyi
-rw-r--r-- 1 enkeyz enkeyz 2389 febr 9 16.36 version.py
-rw-r--r-- 1 enkeyz enkeyz 362 febr 9 16.36 version.pyi
It looks like the latest version of pygame includes type stubs within its package. It's also marked "py.typed". I ran pyright --verifytypes pygame
, and it indicates a type completeness of 70.2%, which is decent.
I noticed that pygame is shipping their tests with the package (which is generally not a good idea). If I delete the test subdirectory, here's the output:
Public symbols: 3014
Symbols with unknown type: 593
Functions with missing docstring: 616
Functions with missing default param: 14
Classes with missing docstring: 51
Type completeness score: 80.3%
I haven't yet done any manual comparisons of the pygame packaged stubs with those that are included in pylance.
Thanks, at least __init__.pyi
is there. We'll have to install this and see, I suppose. Perhaps it's missing things, or isn't following the stub specs and we are missing data.
So, just a quick question about stubs(I'm not really into the topic): why type hintings(in .py files) are not enough to provide auto completion? I mean, I always do type hinting without creating these .pyi files, and works well.
They can be enough info when inlined. Typically we see people including them as separate files because they are slowly integrating them into their code, have to support Python 2 (no annotations) or older version of Python 3 (fewer features), or have compiled code that does not have a py file.
Stubs are enough for completions (that's how all of the standard library is typed), though require more work to access info like docstrings.
The fact that nothing shows up at all is another problem.
Many .py files lack type annotations for function input parameters, function return parameters, and (public) instance variables. It's possible to include such type annotations in the .py files, and we generally recommend to library authors that they include these "inlined" types. We've prepared detailed guidance for library authors.
Ahh, okey. Ty guys.
FWIW, this setting was the source of a similar problem over in #632:
"python.analysis.useLibraryCodeForTypes": false
Commenting that out fixed the problem for me. I don't even remember why I put that in.
I experience the same issue on macOS. I installed pymongo
in a new poetry
project and PyLance is unable to resolve the import:
Version info
$% sw_vers && poetry --version && poetry run pip --version
ProductName: macOS
ProductVersion: 11.2.1
BuildVersion: 20D74
Poetry version 1.1.4
pip 21.0.1 from ~/Library/Caches/pypoetry/virtualenvs/my-project-qc0fEMS4-py3.8/lib/python3.8/site-packages/pip (python 3.8)
Extension version info PyLance version 2021.2.3 (17 February 2021) Python version 2021.2.1 (19 February 2021)
This comment on the related issue https://github.com/microsoft/vscode-python/issues/8372 helped me only partially. The path is correct, but PyLance will not recognize the import, despite adding "python.venvPath": "~/Library/Caches/pypoetry/virtualenvs/"
to my settings.json.
Also, setting "python.analysis.useLibraryCodeForTypes": true
in my settings.json had no effect, either.
Could anybody help me, please?
@martin-braun Some trace logs would be useful: https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#filing-an-issue
We use the interpreter given to us by the core extension to get paths; I'm not sure how venvPath
affects the interpreter selection.
Hi @jakebailey, thank you for your time. Here is my tracelog when I open the file with the issue:
[FG] parsing: [...]/import_product_meta.py (63ms)
[FG] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 3ms] (82ms)
[FG] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/builtins.pyi (36ms)
[FG] binding: [...]/import_product_meta.py (4ms)
Background analysis message: getDiagnosticsForRange
Background analysis message: getSemanticTokens
[BG(1)] parsing: [...]/import_product_meta.py (53ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 2ms] (87ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/builtins.pyi (33ms)
[BG(1)] binding: [...]/import_product_meta.py (5ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/argparse.pyi [fs read 0ms] (15ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/argparse.pyi (5ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 1ms] (8ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (1ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/typing.pyi [fs read 0ms] (20ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/typing.pyi (9ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stubs/typing-extensions/typing_extensions.pyi [fs read 0ms] (5ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stubs/typing-extensions/typing_extensions.pyi (1ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/datetime.pyi [fs read 0ms] (7ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/datetime.pyi (3ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/json/__init__.pyi [fs read 0ms] (2ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/json/__init__.pyi (0ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/json/encoder.pyi [fs read 0ms] (0ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/json/encoder.pyi (1ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/abc.pyi [fs read 0ms] (0ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/abc.pyi (0ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/json/decoder.pyi [fs read 0ms] (0ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/json/decoder.pyi (0ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/pathlib.pyi [fs read 0ms] (3ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/pathlib.pyi (2ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/os/__init__.pyi [fs read 0ms] (13ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/os/__init__.pyi (8ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/pprint.pyi [fs read 0ms] (1ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/pprint.pyi (0ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/uuid.pyi [fs read 0ms] (2ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/uuid.pyi (2ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/warnings.pyi [fs read 0ms] (3ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/warnings.pyi (0ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/_warnings.pyi [fs read 1ms] (1ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/_warnings.pyi (0ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/io.pyi [fs read 0ms] (5ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/io.pyi (4ms)
[BG(1)] parsing: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/types.pyi [fs read 0ms] (9ms)
[BG(1)] binding: ~/.vscode/extensions/ms-python.vscode-pylance-2021.2.3/dist/typeshed-fallback/stdlib/types.pyi (3ms)
Background analysis message: getSemanticTokens
Background analysis message: analyze
[BG(1)] analyzing: [...]/import_product_meta.py ...
[BG(1)] checking: [...]/import_product_meta.py (62ms)
[BG(1)] analyzing: [...]/import_product_meta.py (62ms)
Background analysis message: resumeAnalysis
(I truncated some paths for privacy reasons.)
We use the interpreter given to us by the core extension to get paths; I'm not sure how venvPath affects the interpreter selection.
Me neither, I'm just clutching at any straw. Unfortunately, I'm very new to Python and don't know how to attempt to fix this issue by myself. I assume PyLance been tested with poetry
, so I'm thankful of any hint in what direction I should go to fix this, now.
Thanks in advance.
The important lines would have been printed at the top; on startup, Pylance prints out the search paths it got from the interpreter, and that's the part of the logs I am interested in. Those logs appear to be somewhere in the middle. Maybe reload and see if you can capture the startup instead?
@jakebailey Alright, here is what I got on top of my logs:
[Info - 12:27:17 AM] Pylance language server 2021.2.4 (pyright a18e6fb4) starting
[Info - 12:27:17 AM] Server root directory: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist
[Info - 12:27:17 AM] No configuration file found.
[Info - 12:27:17 AM] Setting pythonPath for service "MK_DATA_MIGRATION": "/Applications/Xcode.app/Contents/Developer/usr/bin/python3"
[Error - 12:27:17 AM] stubPath /Users/marty/Projects/CT/MK_DATA_MIGRATION/typings is not a valid directory.
[Info - 12:27:17 AM] Assuming Python version 3.8
[Info - 12:27:17 AM] Assuming Python platform Darwin
[Info - 12:27:17 AM] Searching for source files
[Info - 12:27:17 AM] Found 3 source files
[Info - 12:27:17 AM] Background analysis(1) root directory: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist
[Info - 12:27:17 AM] Background analysis(1) started
Background analysis message: setConfigOptions
Background analysis message: setTrackedFiles
Background analysis message: markAllFilesDirty
Background analysis message: setFileOpened
Background analysis message: getSemanticTokens
[BG(1)] parsing: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py (49ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 2ms] (70ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/builtins.pyi (29ms)
[BG(1)] binding: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py (7ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/argparse.pyi [fs read 1ms] (16ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/argparse.pyi (5ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 1ms] (9ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (2ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/typing.pyi [fs read 0ms] (19ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/typing.pyi (12ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stubs/typing-extensions/typing_extensions.pyi [fs read 0ms] (4ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stubs/typing-extensions/typing_extensions.pyi (2ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/datetime.pyi [fs read 0ms] (6ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/datetime.pyi (4ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/__init__.pyi [fs read 14ms] (18ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/__init__.pyi (1ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/encoder.pyi [fs read 0ms] (0ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/encoder.pyi (0ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/abc.pyi [fs read 0ms] (1ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/abc.pyi (0ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/decoder.pyi [fs read 0ms] (0ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/decoder.pyi (0ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/pathlib.pyi [fs read 0ms] (6ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/pathlib.pyi (4ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/os/__init__.pyi [fs read 1ms] (21ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/os/__init__.pyi (7ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/pprint.pyi [fs read 1ms] (3ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/pprint.pyi (0ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/uuid.pyi [fs read 0ms] (2ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/uuid.pyi (2ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/warnings.pyi [fs read 0ms] (2ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/warnings.pyi (1ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/_warnings.pyi [fs read 0ms] (0ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/_warnings.pyi (2ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/io.pyi [fs read 1ms] (7ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/io.pyi (2ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/types.pyi [fs read 0ms] (8ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/types.pyi (3ms)
Background analysis message: getSemanticTokens
Background analysis message: analyze
[BG(1)] analyzing: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py ...
[BG(1)] checking: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py (58ms)
[BG(1)] analyzing: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py (58ms)
Background analysis message: resumeAnalysis
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
[FG] parsing: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py (52ms)
[FG] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 2ms] (67ms)
[FG] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/builtins.pyi (28ms)
[FG] binding: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py (4ms)
Background analysis message: invalidateAndForceReanalysis
[Info - 12:27:19 AM] Searching for source files
[Info - 12:27:19 AM] Found 3 source files
Background analysis message: setTrackedFiles
Background analysis message: markAllFilesDirty
Background analysis message: analyze
[BG(1)] analyzing: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py ...
[BG(1)] parsing: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py (16ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 0ms] (22ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/builtins.pyi (14ms)
[BG(1)] binding: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py (2ms)
[BG(1)] checking: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py ...
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/argparse.pyi [fs read 1ms] (7ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/argparse.pyi (2ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/datetime.pyi [fs read 0ms] (5ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/datetime.pyi (2ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/__init__.pyi [fs read 0ms] (1ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/__init__.pyi (0ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/typing.pyi [fs read 0ms] (6ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/typing.pyi (5ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/encoder.pyi [fs read 1ms] (1ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/encoder.pyi (0ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 0ms] (4ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (1ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/abc.pyi [fs read 0ms] (0ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/abc.pyi (0ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/decoder.pyi [fs read 0ms] (1ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/json/decoder.pyi (0ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/pathlib.pyi [fs read 0ms] (3ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/pathlib.pyi (2ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/os/__init__.pyi [fs read 0ms] (10ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/os/__init__.pyi (3ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/pprint.pyi [fs read 0ms] (0ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/pprint.pyi (1ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/uuid.pyi [fs read 0ms] (1ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/uuid.pyi (0ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/warnings.pyi [fs read 0ms] (2ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/warnings.pyi (0ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/_warnings.pyi [fs read 0ms] (0ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/_warnings.pyi (1ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stubs/typing-extensions/typing_extensions.pyi [fs read 0ms] (1ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stubs/typing-extensions/typing_extensions.pyi (1ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/io.pyi [fs read 1ms] (2ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/io.pyi (1ms)
[BG(1)] parsing: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/types.pyi [fs read 5ms] (9ms)
[BG(1)] binding: /Users/marty/.vscode/extensions/ms-python.vscode-pylance-2021.2.4/dist/typeshed-fallback/stdlib/types.pyi (1ms)
[BG(1)] checking: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py (199ms)
[BG(1)] analyzing: /Users/marty/Projects/CT/MK_DATA_MIGRATION/import_product_meta.py (253ms)
Background analysis message: resumeAnalysis
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
Yeah, there is something wrong going on with that interpreter. We should have printed out a list of search paths that the interpreter gave, but none were printed. See the original report for an example.
I'll also point out that it says that it's using Xcode's Python, but this issue is about pipenv; do you have the right interpreter selected in VS Code at the bottom left?
@jakebailey Thank you so much. I'm new to Python and missed the fact that I had to select the right interpreter in the bottom left, the wrong interpreter was selected.
Now it works. I really appreciate your help! :)
@jakebailey sorry for hijacking but looks like I have kind of similar issue, despite my virtualenv being properly setup (at least I think...). Please note that I am using de .devcontainer config which uses a python3 docker file from the templates provided by VS Code. Probably a dumb mistake on my side...
Here are the logs:
[Info - 6:46:52 AM] Pylance language server 2021.4.2 (pyright 3888d715) starting
[Info - 6:46:52 AM] Server root directory: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist
[Info - 6:47:04 AM] No configuration file found.
[Info - 6:47:04 AM] No pyproject.toml file found.
[Info - 6:47:04 AM] Setting pythonPath for service "test-pipenv": "/home/vscode/.local/share/virtualenvs/test-pipenv-A2tHJRgc/bin/python"
[Warn - 6:47:04 AM] stubPath /workspaces/test-pipenv/typings is not a valid directory.
[Info - 6:47:04 AM] Assuming Python version 3.9
[Info - 6:47:04 AM] Assuming Python platform Linux
Search paths for /workspaces/test-pipenv
/home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib
/workspaces/test-pipenv
/workspaces/test-pipenv/typings
/home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stubs/...
/home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/bundled/stubs
/usr/local/lib/python3.9
/usr/local/lib/python3.9/lib-dynload
/home/vscode/.local/share/virtualenvs/test-pipenv-A2tHJRgc/lib/python3.9/site-packages
[Info - 6:47:04 AM] Searching for source files
[Info - 6:47:04 AM] Found 1 source file
Background analysis message: setConfigOptions
Background analysis message: ensurePartialStubPackages
Background analysis message: setTrackedFiles
Background analysis message: markAllFilesDirty
Background analysis message: getSemanticTokens delta
[BG(1)] getSemanticTokens delta previousResultId:1619592412872 at /workspaces/test-pipenv/my.py ...
[BG(1)] parsing: /workspaces/test-pipenv/my.py (12ms)
[Info - 6:47:04 AM] Searching for source files
[Info - 6:47:04 AM] Found 1 source file
[BG(1)] parsing: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 0ms] (109ms)
[BG(1)] binding: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib/builtins.pyi (51ms)
[BG(1)] binding: /workspaces/test-pipenv/my.py (1ms)
[BG(1)] parsing: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib/typing.pyi [fs read 0ms] (42ms)
[BG(1)] binding: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib/typing.pyi (9ms)
[BG(1)] parsing: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 0ms] (9ms)
[BG(1)] binding: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (2ms)
[BG(1)] parsing: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stubs/typing-extensions/typing_extensions.pyi [fs read 0ms] (3ms)
[BG(1)] binding: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stubs/typing-extensions/typing_extensions.pyi (1ms)
[BG(1)] parsing: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stubs/requests/requests/__init__.pyi [fs read 0ms] (2ms)
[BG(1)] binding: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stubs/requests/requests/__init__.pyi (1ms)
[BG(1)] getSemanticTokens delta previousResultId:1619592412872 at /workspaces/test-pipenv/my.py (249ms)
Background analysis message: analyze
[BG(1)] analyzing: /workspaces/test-pipenv/my.py ...
[BG(1)] checking: /workspaces/test-pipenv/my.py (1ms)
[BG(1)] analyzing: /workspaces/test-pipenv/my.py (1ms)
Background analysis message: invalidateAndForceReanalysis
Background analysis message: invalidateAndForceReanalysis
Background analysis message: invalidateAndForceReanalysis
Background analysis message: setTrackedFiles
Background analysis message: markAllFilesDirty
Background analysis message: analyze
[BG(1)] analyzing: /workspaces/test-pipenv/my.py ...
[BG(1)] parsing: /workspaces/test-pipenv/my.py (47ms)
[BG(1)] parsing: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 0ms] (49ms)
[BG(1)] binding: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib/builtins.pyi (28ms)
[BG(1)] binding: /workspaces/test-pipenv/my.py (1ms)
[BG(1)] checking: /workspaces/test-pipenv/my.py ...
[BG(1)] parsing: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stubs/requests/requests/__init__.pyi [fs read 0ms] (2ms)
[BG(1)] binding: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stubs/requests/requests/__init__.pyi (0ms)
[BG(1)] checking: /workspaces/test-pipenv/my.py (3ms)
[BG(1)] analyzing: /workspaces/test-pipenv/my.py (128ms)
Background analysis message: resumeAnalysis
Background analysis message: resumeAnalysis
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
[FG] parsing: /workspaces/test-pipenv/my.py (55ms)
[FG] parsing: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 2ms] (213ms)
[FG] binding: /home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2021.4.2/dist/typeshed-fallback/stdlib/builtins.pyi (38ms)
[FG] binding: /workspaces/test-pipenv/my.py (0ms)
And here the packages currently available in my venv:
vscode ➜ /workspaces/test-pipenv $ pipenv shell
Launching subshell in virtual environment...
vscode ➜ /workspaces/test-pipenv $ . /home/vscode/.local/share/virtualenvs/test-pipenv-A2tHJRgc/bin/activate
(test-pipenv) vscode ➜ /workspaces/test-pipenv $ pip list
Package Version
---------- ---------
certifi 2020.12.5
chardet 4.0.0
idna 2.10
pip 21.0.1
requests 2.25.1
setuptools 54.1.2
urllib3 1.26.4
wheel 0.36.2
(test-pipenv) vscode ➜ /workspaces/test-pipenv $ ls ~/.local/share/virtualenvs/test-pipenv-A2tHJRgc/lib/python3.9/site-packages/ -al
total 100
drwxr-xr-x 21 vscode vscode 4096 Apr 28 06:45 .
drwxr-xr-x 3 vscode vscode 4096 Apr 28 06:45 ..
drwxr-xr-x 2 vscode vscode 4096 Apr 28 06:45 __pycache__
drwxr-xr-x 2 vscode vscode 4096 Apr 28 06:45 _distutils_hack
-rw-r--r-- 1 vscode vscode 18 Apr 28 06:45 _virtualenv.pth
-rw-r--r-- 1 vscode vscode 5662 Apr 28 06:45 _virtualenv.py
drwxr-xr-x 3 vscode vscode 4096 Apr 28 06:45 certifi
drwxr-xr-x 2 vscode vscode 4096 Apr 28 06:45 certifi-2020.12.5.dist-info
drwxr-xr-x 5 vscode vscode 4096 Apr 28 06:45 chardet
drwxr-xr-x 2 vscode vscode 4096 Apr 28 06:45 chardet-4.0.0.dist-info
-rw-r--r-- 1 vscode vscode 152 Apr 28 06:45 distutils-precedence.pth
drwxr-xr-x 3 vscode vscode 4096 Apr 28 06:45 idna
drwxr-xr-x 2 vscode vscode 4096 Apr 28 06:45 idna-2.10.dist-info
drwxr-xr-x 4 vscode vscode 4096 Apr 28 06:45 pip
drwxr-xr-x 2 vscode vscode 4096 Apr 28 06:45 pip-21.0.1.dist-info
-rw-r--r-- 1 vscode vscode 0 Apr 28 06:45 pip-21.0.1.virtualenv
drwxr-xr-x 5 vscode vscode 4096 Apr 28 06:45 pkg_resources
drwxr-xr-x 3 vscode vscode 4096 Apr 28 06:45 requests
drwxr-xr-x 2 vscode vscode 4096 Apr 28 06:45 requests-2.25.1.dist-info
drwxr-xr-x 6 vscode vscode 4096 Apr 28 06:45 setuptools
drwxr-xr-x 2 vscode vscode 4096 Apr 28 06:45 setuptools-54.1.2.dist-info
-rw-r--r-- 1 vscode vscode 0 Apr 28 06:45 setuptools-54.1.2.virtualenv
drwxr-xr-x 6 vscode vscode 4096 Apr 28 06:45 urllib3
drwxr-xr-x 2 vscode vscode 4096 Apr 28 06:45 urllib3-1.26.4.dist-info
drwxr-xr-x 4 vscode vscode 4096 Apr 28 06:45 wheel
drwxr-xr-x 2 vscode vscode 4096 Apr 28 06:45 wheel-0.36.2.dist-info
-rw-r--r-- 1 vscode vscode 0 Apr 28 06:45 wheel-0.36.2.virtualenv
Any update on this one?
EDIT: Looks like it's fixed. Can you guys confirm it?
Environment data
Expected behaviour
Flawless auto-completion and syntax highlighting with third party python modules. With Jedi language server, I don't have this issue.
Actual behaviour
When I create a venv with pipenv, and installing pygame, switching to that virtual environment in vscode, syntax highlighting and auto completion stops working(restarting vscode don't have any effect).
It's also interesting, if you don't install a python module globally with pip, the auto completion and highlighting works flawlessly, but as soon as you install a package globally, those two things stops working in vscode.
with "/usr/bin/python3.9" interpreter(it's working perfectly, even tho pygame wasn't installed globally, for this interpreter):
with my pipenv interpreter, pygame installed locally):
Logs
Code Snippet / Additional information