python-lsp / python-lsp-server

Fork of the python-language-server project, maintained by the Spyder IDE team and the community
MIT License
1.96k stars 194 forks source link

jedi.api.environment.InvalidPythonEnvironment: <conda_env_path>/bin/python seems to be missing. #556

Open MordorianGuy opened 6 months ago

MordorianGuy commented 6 months ago

I get this error with the 1.10.1 version. The binary exists and is named as python3.12. The path to the environment was set via pylsp.plugins.jedi.environment option. Full traceback:

<datetime> - WARNING - pylsp.config.config - Failed to load hook pylsp_hover: <work_env_path>/bin/python seems to be missing.
Traceback (most recent call last):
  File "<lab_env_path>/lib/python3.11/site-packages/pylsp/config/config.py", line 39, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<lab_env_path>/lib/python3.11/site-packages/pluggy/_manager.py", line 473, in traced_hookexec
    return outcome.get_result()
           ^^^^^^^^^^^^^^^^^^^^
  File "<lab_env_path>/lib/python3.11/site-packages/pluggy/_result.py", line 99, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "<lab_env_path>/lib/python3.11/site-packages/pluggy/_result.py", line 61, in from_call
    result = func()
             ^^^^^^
  File "<lab_env_path>/lib/python3.11/site-packages/pluggy/_manager.py", line 470, in <lambda>
    lambda: oldcall(hook_name, hook_impls, caller_kwargs, firstresult)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<lab_env_path>/lib/python3.11/site-packages/pluggy/_callers.py", line 138, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "<lab_env_path>/lib/python3.11/site-packages/pluggy/_callers.py", line 102, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<lab_env_path>/lib/python3.11/site-packages/pylsp/plugins/hover.py", line 14, in pylsp_hover
    definitions = document.jedi_script(use_document_path=True).infer(**code_position)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<lab_env_path>/lib/python3.11/site-packages/pylsp/workspace.py", line 33, in wrapper
    return method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<lab_env_path>/lib/python3.11/site-packages/pylsp/workspace.py", line 534, in jedi_script
    self.get_enviroment(environment_path, env_vars=env_vars)
  File "<lab_env_path>/lib/python3.11/site-packages/pylsp/workspace.py", line 566, in get_enviroment
    environment = jedi.api.environment.create_environment(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<lab_env_path>/lib/python3.11/site-packages/jedi/api/environment.py", line 367, in create_environment
    return Environment(_get_executable_path(path, safe=safe), env_vars=env_vars)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<lab_env_path>/lib/python3.11/site-packages/jedi/api/environment.py", line 380, in _get_executable_path
    raise InvalidPythonEnvironment("%s seems to be missing." % python)
jedi.api.environment.InvalidPythonEnvironment: <work_env_path>/bin/python seems to be missing.