Skip to content

Jedi InvalidPythonEnvironment error #22659

Closed

Description

Type: Bug

Steps to reproduce:

  1. In our CI, we get symbols from the python extension using this
vscode.commands.executeCommand<vscode.DocumentSymbol[]>('vscode.executeDocumentSymbolProvider', document. uri)
  1. After we get the error jedi.api.environment.InvalidPythonEnvironment: bin/python seems to be missing.: Error: jedi.api.environment.InvalidPythonEnvironment: bin/python seems to be missing.
  • This was NOT throwing the error in 2023.20.0 and before, but STARTED in 2023.22.0 and still does it with the latest version (2023.22.1)
  • The jedi error comes from here

Diagnostic data

  • Python version: 3.10
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): don't think we are explicitly using any
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

XXX

User Settings


languageServer: "Pylance"

Extension version: 2023.22.1
VS Code version: Code 1.85.0 (Universal) (af28b32d7e553898b2a91af498b1fb666fdebe0c, 2023-12-06T18:18:04.614Z)
OS version: Darwin arm64 22.6.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (10 x 24)
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 9, 8, 7
Memory (System) 32.00GB (0.06GB free)
Process Argv --crash-reporter-id 57a1edb2-7321-4da4-8ac4-0dac8475ab2b
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30899288
vscaat:30438848
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyone:30548225
2e4cg342:30602488
f6dab269:30613381
2i9eh265:30646982
showlangstatbar:30737416
962ge761:30917236
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
welcomedialogc:30910334
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixt:30902429
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementst:30887150
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
aa_t_chat:30882232
dsvsc019:30917259

Activity

  1. karthiknadig commented on Dec 16, 2023

    @karthiknadig
    Member

    Can you share the logs from Output > Python?

  2. toddhow commented on Dec 23, 2023

    @toddhow

    I'm getting a similar error, I'm not sure where its getting Scripts\python.exe though. My python executable is current\python.exe.

    Message: jedi.api.environment.InvalidPythonEnvironment: Scripts\python.exe seems to be missing.
    
  3. toddhow commented on Dec 23, 2023

    @toddhow

    Lines 370-383 of /jedi/api/environment.py

    def _get_executable_path(path, safe=True):
        """
        Returns None if it's not actually a virtual env.
        """
    
        if os.name == 'nt':
            python = os.path.join(path, 'Scripts', 'python.exe')
        else:
            python = os.path.join(path, 'bin', 'python')
        if not os.path.exists(python):
            raise InvalidPythonEnvironment("%s seems to be missing." % python)
    
        _assert_safe(python, safe)
        return python
  4. mieky commented on Dec 27, 2023

    @mieky

    Can confirm this issue does not exist in the older 2023.20.0. For anyone looking for a quick fix, you can downgrade to this version: Extensions > Python > Settings > Install Another Version > 2023.20.0.

    Screenshot 2023-12-27 at 12 57 12
  5. karthiknadig commented on Jan 3, 2024

    @karthiknadig
    Member

    This was introduced in #22466 . We should change that to pass executable instead of the environment directory. It looks like Jedi does not handle Conda like environments.

  6. lmerynda commented on Feb 1, 2024

    @lmerynda

    When is the new release planned to address this problem? It seems silly to keep telling people they need to revert to the previous version, while the fix has been in the maintrack for almost a month. If the actual release is too far ahead could it be released as a bugfix instead?

  7. karthiknadig commented on Feb 1, 2024

    @karthiknadig
    Member

    We have a pinned issue that provides the release dates see here: #22669

    you can also use the pre-release version to try out the latest.

  8. lmerynda commented on Feb 1, 2024

    @lmerynda

    Awesome! Thank you for your great work, I will try the pre-release version with our env setup to confirm it is fixed indeed :)

  9. rupurt commented on Feb 5, 2024

    @rupurt

    I ran into this on Nix. I need to build a custom version of the python interpreter that links to libstdc++ for manylinux dependencies. Not sure how to work around it?

  10. locked as resolved and limited conversation to collaborators on Mar 7, 2024
  11. added 2 commits that reference this issue on Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions