Skip to content

jedi.api.environment.InvalidPythonEnvironment + conda #22672

Closed

Description

@DavidWalz

Type: Bug

Behaviour

Similar to #22659 also when using conda, VS code + jedi seem to be looking for python at the wrong location.
As a consequence, "go to definition" and other language features don't work.

Using the conda base environment

Message: jedi.api.environment.InvalidPythonEnvironment: <condadir>\Scripts\python.exe seems to be missing.

This should be <condadir>/python.exe

Using another conda environment

Message: jedi.api.environment.InvalidPythonEnvironment: <condadir>\envs\<env>\Scripts\python.exe seems to be missing.

This should be <condadir>/envs/<env>/python.exe

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.1
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
  • Value of the python.languageServer setting: Default
Output for Python Language Server in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

2023-12-18 17:34:34.156 [info]   Message: jedi.api.environment.InvalidPythonEnvironment: <condadir>\Scripts\python.exe seems to be missing.
  Code: -32602 
{
  'traceback': [
    '  File ".vscode\\extensions\\ms-python.python-2023.22.1\\pythonFiles\\lib\\jedilsp\\pygls\\protocol.py", line 340, in _handle_request self._execute_request(msg_id, handler, params)\n',
    '  File ".vscode\\extensions\\ms-python.python-2023.22.1\\pythonFiles\\lib\\jedilsp\\pygls\\protocol.py", line 264, in _execute_request self._send_response(msg_id, handler(params))\n',
    '  File ".vscode\\extensions\\ms-python.python-2023.22.1\\pythonFiles\\lib\\jedilsp\\jedi_language_server\\server.py", line 380, in hover jedi_script = jedi_utils.script(server.project, document)\n',
    '  File ".vscode\\extensions\\ms-python.python-2023.22.1\\pythonFiles\\lib\\jedilsp\\jedi_language_server\\jedi_utils.py", line 118, in script return Script(code=document.source, path=document.path, project=project)\n',
    '  File ".vscode\\extensions\\ms-python.python-2023.22.1\\pythonFiles\\lib\\jedilsp\\jedi\\api\\__init__.py", line 119, in __init__ self._inference_state = InferenceState(\n',
    '  File ".vscode\\extensions\\ms-python.python-2023.22.1\\pythonFiles\\lib\\jedilsp\\jedi\\inference\\__init__.py", line 87, in __init__ environment = project.get_environment()\n',
    '  File ".vscode\\extensions\\ms-python.python-2023.22.1\\pythonFiles\\lib\\jedilsp\\jedi\\api\\project.py", line 245, in get_environment self._environment = create_environment(self._environment_path, safe=False)\n',
    '  File ".vscode\\extensions\\ms-python.python-2023.22.1\\pythonFiles\\lib\\jedilsp\\jedi\\api\\environment.py", line 367, in create_environment return Environment(_get_executable_path(path, safe=safe), env_vars=env_vars)\n',
    '  File ".vscode\\extensions\\ms-python.python-2023.22.1\\pythonFiles\\lib\\jedilsp\\jedi\\api\\environment.py", line 380, in _get_executable_path raise InvalidPythonEnvironment("%s seems to be missing." % python)\n'
  ]
}

User Settings

Multiroot scenario, following user settings may not apply:

languageServer: "Jedi"

testing
• pytestEnabled: true

terminal
• activateEnvironment: false

Extension version: 2023.22.1
VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:49:37.021Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz (8 x 2304)
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) undefined
Memory (System) 31.78GB (16.72GB free)
Process Argv
Screen Reader no
VM 0%

Activity

  1. RollsChris commented on Jan 10, 2024

    @RollsChris

    Hey this is still happening in the pre-release v2023.23.13541005... any ideas on how to fix

  2. karthiknadig commented on Jan 10, 2024

    @karthiknadig
    Member

    Christopher Rollings (@RollsChris) Sorry the build with the fix was not out. This version has the fix: 2023.25.10101826

  3. locked as resolved and limited conversation to collaborators on Feb 10, 2024
  4. 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

triage-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