Vscode-python: Jedi go-to not working. Shows errors.

Created on 7 Aug 2020  路  5Comments  路  Source: microsoft/vscode-python

Environment data

  • VS Code version: 1.47.3 (from Snap)
  • Extension version (available under the Extensions sidebar): v2020.7.96456
  • OS and version: Ubuntu 18.04.4 LTS
  • Python version: The version of the used cond env is python 3.7.4
  • Type of virtual environment used: conda
  • Relevant/affected Python packages and their versions: jedi 0.17.1
  • Value of the python.languageServer setting: jedi

Expected behaviour

Right-Click on a Class name and "Go To Definition" should jump to the definition of the class.

Actual behaviour

If the class is defined in the same file, it worgs.
But if the class if defined somewhere else, the GUI tells me "No definitions found for 'YourClass'.

Also I can observe error messages / deprecation warnings in the output window.

Logs

Error 2020-08-07 12:48:42: stderr jediProxy Error (stderr) /home/me/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/completion.py:589: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  all_scopes=True,

Error 2020-08-07 12:49:37: stderr jediProxy Error (stderr) /home/me/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/completion.py:600: DeprecationWarning: Providing the line is now done in the functions themselves like `Script(...).complete(line, column)`
  sys_path=sys.path,

Error 2020-08-07 12:49:37: stderr jediProxy Error (stderr) /home/me/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/completion.py:600: DeprecationWarning: Providing the column is now done in the functions themselves like `Script(...).complete(line, column)`
  sys_path=sys.path,
/home/me/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/completion.py:600: DeprecationWarning: Deprecated since version 0.17.0. Use the project API instead, which means Script(project=Project(dir, sys_path=sys_path)) instead.
  sys_path=sys.path,

Error 2020-08-07 12:49:37: stderr jediProxy Error (stderr) /home/me/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/completion.py:628: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).infer instead.
  script.goto_definitions(), request["id"]

Error 2020-08-07 12:49:47: stderr jediProxy Error (stderr) /home/me/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/completion.py:605: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).goto instead.
  script.goto_assignments(follow_imports=True), request["id"]
investigating type-bug

All 5 comments

@DanielBiskup, thanks for letting us know about this. Do you have some code we can look at? In particular, what how are you importing YourClass into the file where you get the error?

I can't share code, but it probably looks something like this:

YourClass is defined in a different module but in the same package.
So YourClass might be defined in somepackage.aaa.yourclass and in somepackage.bbb.usingithere I import YourClass with from somepackage.aaa.yourclass import YourClass.
The somepackage is also installed to the environment with pip install --editable.
When I run the my program it runs as expected without errors.

Please let me know if this elaboration helped.

Edit: Found issue. It seems (unsure why) VSCode bugs out when no there is no Python interpreter selected. I personally use pyenv, and have Python 3.8.0 as my global default. Doing Select Interpreter in VSCode and choosing my PyEnv 3.8.0 installation fixes the issue.

Errors below are still thrown -- but VSCode now navigates to the correct definitions.


Simply doing:

import jwt

And then trying to CMD click jwt throws error:

Error 2020-08-22 00:10:17: stderr jediProxy Error (stderr) /Users/felipefaria/.vscode/extensions/ms-python.python-2020.8.103604/pythonFiles/completion.py:586: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-08-22 00:10:18: stderr jediProxy Error (stderr) /Users/felipefaria/.vscode/extensions/ms-python.python-2020.8.103604/pythonFiles/completion.py:594: DeprecationWarning: Providing the line is now done in the functions themselves like `Script(...).complete(line, column)`
  script = jedi.Script(

Error 2020-08-22 00:10:18: stderr jediProxy Error (stderr) /Users/felipefaria/.vscode/extensions/ms-python.python-2020.8.103604/pythonFiles/completion.py:594: DeprecationWarning: Providing the column is now done in the functions themselves like `Script(...).complete(line, column)`
  script = jedi.Script(
/Users/felipefaria/.vscode/extensions/ms-python.python-2020.8.103604/pythonFiles/completion.py:594: DeprecationWarning: Deprecated since version 0.17.0. Use the project API instead, which means Script(project=Project(dir, sys_path=sys_path)) instead.
  script = jedi.Script(

Error 2020-08-22 00:10:18: stderr jediProxy Error (stderr) /Users/felipefaria/.vscode/extensions/ms-python.python-2020.8.103604/pythonFiles/completion.py:605: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).goto instead.
  script.goto_assignments(follow_imports=True), request["id"]

Error 2020-08-22 00:10:18: stderr jediProxy Error (stderr) /Users/felipefaria/.vscode/extensions/ms-python.python-2020.8.103604/pythonFiles/completion.py:628: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).infer instead.
  script.goto_definitions(), request["id"]

This only seems to happen to Python packages installed via pip. Vanilla modules work fine:

import textwrap

To replicate issue (on Mac OS):

  • Install + setup pyenv into system.

    • pyenv install 3.8.0 and pyenv global 3.8.0

  • Install any external module from PyPi into 3.8.0.

    • pip install requests

  • Open VSCode and import any external module.

    • import requests

  • Command+Click module. VSCode will use Python 2.7 (shipped with OSX) to try to find definition, and won't be able to. External linters (like PyLint) will automatically figure itself out and not throw errors that the package is missing.

I understand pyenv is an edge case, but perhaps it's worth running a simple check on vscode-python initialization via bash python --version to set default interpreter on load. I assume @DanielBiskup's case is similar to this. Conda environment is recognized globally in the system, but VS Code does not automatically change interpreter settings and is unable to use Jedi. Deprecation errors will still occur regardless if before or after fix.

Same issue here:
Right click -> Go to definition -> Nothing happens

  • VS Code version: 1.49.2
  • Extension version : v2020.9.111407
  • OS and version: Windows 10
  • Python version: Python 3.8.5

Error 2020-09-28 13:59:19: stderr jediProxy Error (stderr) c:\Users\...\.vscode\extensions\ms-python.python-2020.9.111407\pythonFiles\completion.py:603: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).goto instead. script.goto_assignments(follow_imports=True), request["id"]

In my case the error has something to do with Git. By deleting the hidden .git folder from the project I can get it working again.

Exact same issue with pyenv and python 3.9.0

Error 2020-11-03 21:12:21: stderr jediProxy Error (stderr) /home/user/.vscode-server/extensions/ms-python.python-2020.10.332292344/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-03 21:12:22: stderr jediProxy Error (stderr) /home/user/.vscode-server/extensions/ms-python.python-2020.10.332292344/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

Error 2020-11-03 21:12:24: stderr jediProxy Error (stderr) /home/user/.vscode-server/extensions/ms-python.python-2020.10.332292344/pythonFiles/completion.py:592: DeprecationWarning: Providing the line is now done in the functions themselves like `Script(...).complete(line, column)`
  script = jedi.Script(
/home/user/.vscode-server/extensions/ms-python.python-2020.10.332292344/pythonFiles/completion.py:592: DeprecationWarning: Providing the column is now done in the functions themselves like `Script(...).complete(line, column)`
  script = jedi.Script(

Error 2020-11-03 21:12:24: stderr jediProxy Error (stderr) /home/user/.vscode-server/extensions/ms-python.python-2020.10.332292344/pythonFiles/completion.py:592: DeprecationWarning: Deprecated since version 0.17.0. Use the project API instead, which means Script(project=Project(dir, sys_path=sys_path)) instead.
  script = jedi.Script(
/home/user/.vscode-server/extensions/ms-python.python-2020.10.332292344/pythonFiles/completion.py:603: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).goto instead.
  script.goto_assignments(follow_imports=True), request["id"]

Error 2020-11-03 21:12:24: stderr jediProxy Error (stderr) /home/user/.vscode-server/extensions/ms-python.python-2020.10.332292344/pythonFiles/completion.py:626: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).infer instead.
  script.goto_definitions(), request["id"]

Was this page helpful?
0 / 5 - 0 ratings