Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Python venv dependencies are not working with code completion #7209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wnowicki opened this issue May 13, 2025 · 6 comments
Closed

Python venv dependencies are not working with code completion #7209

wnowicki opened this issue May 13, 2025 · 6 comments
Assignees
Labels
jedi Jedi does something better than Pylance team needs to reproduce Issue has not been reproduced yet user responded Was "waiting for user response" and they responded

Comments

@wnowicki
Copy link

Type: Bug

Behaviour

Python venv dependencies are not working with code completion

Steps to Reproduce

  1. I open my project in new VSC window
  2. I open any Python file.
  3. I can CMD+Click any imported dependencies
  4. After first couple clikcks and uses of autocompletion, I'm loosing this functionality. I cannot click any library or function.
  5. When I open any other file dependencies are not even colored. And I can see scanning efect on the top of the file.

Diagnostic Data

Maybe is related or not but at some point I've managed to get this output:

2025-05-13 16:30:42.808 [error] Stopping language client failed Error: Stopping the server timed out
    at /Users/xxx/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/out/client/extension.js:2:2026466
    at l.stop (/Users/xxx/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/out/client/extension.js:2:22718)

I've found as well simillar issue here astral-sh/uv#9637 but I've tested it for UV and classic venv. And raised this before microsoft/vscode#248842

Extension version: 2025.6.0
VS Code version: Code 1.100.0 (19e0f9e681ecb8e5c09d8784acaa601316ca4571, 2025-05-07T12:48:53.763Z)
OS version: Darwin arm64 24.5.0
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.10
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Jedi"

Installed Extensions
Extension Name Extension Id Version
autodocstring njp 0.6.1
code-spell-checker str 4.0.47
copilot Git 1.317.0
copilot-chat Git 0.27.0
dart-code Dar 3.110.0
datawrangler ms- 1.20.1
debugpy ms- 2025.8.0
docker doc 0.6.0
EditorConfig Edi 0.17.2
even-better-toml tam 0.21.2
flutter Dar 3.110.0
ginfuru-vscode-jekyll-syntax gin 0.1.1
gitlens eam 17.0.3
js-debug ms- 1.100.0
js-debug-companion ms- 1.1.3
json Zai 2.0.2
jupyter ms- 2025.4.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.1.0
LogFileHighlighter emi 3.4.0
lua sum 3.14.0
markdown-all-in-one yzh 3.6.3
markdown-mermaid bie 1.28.0
markdown-pdf yza 1.5.0
mermaid-markdown-syntax-highlighting bpr 1.7.1
partial-diff ryu 1.4.3
pdf tom 1.2.2
python ms- 2025.6.0
rainbow-csv mec 3.19.0
regexsnippets Mon 1.0.2
remote-containers ms- 0.413.0
rest-client hum 0.25.1
robotframework-lsp rob 1.13.0
ruff cha 2025.22.0
shopify-liquid sis 4.0.1
sqlite-viewer qwt 0.10.6
vscode-azure-github-copilot ms- 0.3.268
vscode-azureresourcegroups ms- 0.10.10
vscode-containers ms- 2.0.1
vscode-dotnet-runtime ms- 2.3.3
vscode-drawio hed 1.9.0
vscode-github-actions git 0.27.1
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-markdownlint Dav 0.59.0
vscode-print pdc 1.4.0
vscode-sqlite ale 0.14.1
vsliveshare ms- 1.0.5948
System Info
Item Value
CPUs Apple M3 Pro (12 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 8, 6, 4
Memory (System) 18.00GB (0.14GB free)
Process Argv --crash-reporter-id 0651a787-969e-4665-af65-6f2d0917af2c
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
vscrpc:30673769
962ge761:30959799
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
pythonrstrctxt:31112756
nativeloc1:31192215
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
e5gg6876:31282496
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
31787653:31262186
3e8i5726:31271747
pythonpulldiagcf:31298646
996jf627:31283433
pythonrdcb7:31303018
usemplatestapi:31297334
7bj51361:31289155
747dc170:31275177
pylancecolorcf:31303817
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004

@TomaszBurnejko
Copy link

I have the same issue. The issue is specific to Python projects, in another TypeScript repository, everything works as expected

@BlackDark
Copy link

I also did not have completions for my local projects but when I did a uv sync --no-editable i got the completions back working because the folder gets copied to the .venv directory I think. But of course now also the stuff is fixed and not symlinked so changes get not reflected back to the .venv.

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python May 14, 2025
@github-actions github-actions bot added the team needs to reproduce Issue has not been reproduced yet label May 14, 2025
@rchiodo
Copy link
Contributor

rchiodo commented May 14, 2025

Can you include the log as described here?

https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#filing-an-issue

It sounds like Pylance is crashing for some reason. The log should give us a callstack for where the crash is.

@rchiodo rchiodo added the waiting for user response Requires more information from user label May 14, 2025
@wnowicki
Copy link
Author

@rchiodo

2025-05-14 19:01:16.486 [info] ERROR:pygls.protocol.json_rpc:Failed to handle request 21 textDocument/hover HoverParams(text_document=TextDocumentIdentifier(uri='file:///Users/wojciechnowicki/dev/iamip/tars/app/build.py'), position=1:19, work_done_token=None)
Traceback (most recent call last):
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/pygls/protocol/json_rpc.py", line 266, in _handle_request
    self._execute_request(msg_id, handler, params)
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/pygls/protocol/json_rpc.py", line 188, in _execute_request
    self._send_response(msg_id, handler(params))
                                ^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi_language_server/notebook_utils.py", line 373, in wrapped
    result = f(notebook_server, notebook_params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi_language_server/server.py", line 487, in hover
    jedi_script.help(*jedi_lines),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/api/helpers.py", line 487, in wrapper
    return func(self, line, column, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/api/__init__.py", line 372, in help
    definitions = self.goto(line, column, follow_imports=True)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/api/helpers.py", line 487, in wrapper
    return func(self, line, column, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/api/__init__.py", line 300, in goto
    names = list(name.goto())
                 ^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/names.py", line 157, in goto
    module_names = goto_import(context, name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/cache.py", line 44, in wrapper
    rv = function(obj, *args, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/imports.py", line 75, in goto_import
    _prepare_infer_import(module_context, tree_name)
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/imports.py", line 116, in _prepare_infer_import
    return from_import_name, tuple(import_path), import_node.level, importer.follow()
                                                                    ^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/imports.py", line 296, in follow
    return import_module_by_names(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/imports.py", line 377, in import_module_by_names
    import_module(
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/plugins/__init__.py", line 21, in wrapper
    return built_functions[public_name](*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/plugins/flask.py", line 20, in wrapper
    return callback(inference_state, import_names, module_context, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/gradual/typeshed.py", line 115, in wrapper
    python_value_set = ValueSet.from_sets(
                       ^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/base_value.py", line 430, in from_sets
    for set_ in sets:
                ^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/gradual/typeshed.py", line 116, in <genexpr>
    func(inference_state, import_names, p, sys_path,)
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/imports.py", line 411, in import_module
    file_io_or_ns, is_pkg = inference_state.compiled_subprocess.get_module_info(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/compiled/subprocess/__init__.py", line 188, in wrapper
    result = self._compiled_subprocess.run(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/compiled/subprocess/__init__.py", line 293, in run
    self._send(delete_id, None)
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/inference/compiled/subprocess/__init__.py", line 318, in _send
    is_exception, traceback, result = pickle_load(self._get_process().stdout)
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wojciechnowicki/.vscode/extensions/ms-python.python-2025.6.0-darwin-arm64/python_files/lib/jedilsp/jedi/_compatibility.py", line 25, in pickle_load
    return Unpickler(file).load()
           ^^^^^^^^^^^^^^^^^^^^^^
_pickle.UnpicklingError: invalid load key, ' '.

2025-05-14 19:01:16.489 [info] [Error - 19:01:16] Request textDocument/hover failed.
2025-05-14 19:01:16.489 [info]   Message: _pickle.UnpicklingError: invalid load key, ' '.
  Code: -32603 
[object Object]

@github-actions github-actions bot added user responded Was "waiting for user response" and they responded and removed waiting for user response Requires more information from user labels May 14, 2025
@rchiodo
Copy link
Contributor

rchiodo commented May 14, 2025

This is a bug in Jedi actually, not Pylance:
https://github.com/pappasam/jedi-language-server

Your log indicates you have 'Jedi' selected here:

Image

@rchiodo rchiodo closed this as completed May 14, 2025
@rchiodo rchiodo added the jedi Jedi does something better than Pylance label May 14, 2025
@wnowicki
Copy link
Author

Thanks! I don't know why i got Pylance disabled... now everything works back again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jedi Jedi does something better than Pylance team needs to reproduce Issue has not been reproduced yet user responded Was "waiting for user response" and they responded
Projects
None yet
Development

No branches or pull requests

4 participants