neoclide / coc-python

Python extension for coc.nvim, fork of vscode-python
574 stars 51 forks source link

Jedi 0.17.0 seems break coc-python #175

Open cmcclellen opened 4 years ago

cmcclellen commented 4 years ago

Looks like Jedi 0.17.0 was released yesterday and code completion in coc.nvim/coc-python is broken. Whenever it tries to complete something I get:

[coc.nvim] Jedi error: Traceback (most recent call last):
  File "completion.py", line 624, in watch
    response = self._process_request(rq)
  File "completion.py", line 571, in _process_request
    script = jedi.Script(
  File "XXXXXX/venv/lib/python3.8/site-packages/jedi/api/__init__.py", line 133, in __init__
    project._sys_path = sys_path
AttributeError: 'NoneType' object has no attribute '_sys_path'

The above file path in the exception was edited for brevity.

Moving back to jedi 0.16.0 makes things work again.

naiveai commented 4 years ago

It is unclear whether this is an issue with jedi itself or not - it seems the code in jedi does not take into account the fact that project could be None in this case, or perhaps it does not do that becuase that's not how its clients are supposed to behave.

languitar commented 4 years ago

Any way to downgrade things to a working version? Pretty annoying to work with the constant exceptions.

RaphGL commented 4 years ago

Any way to downgrade things to a working version? Pretty annoying to work with the constant exceptions.

yes! just run:


sudo pip  install --upgrade jedi==0.16.0```
ljvmiranda921 commented 4 years ago

Encountered the same problem. The command above works, sudo and --upgrade may not be required. The following worked for me:

pip install jedi==0.16.0
z0w13 commented 4 years ago

It is unclear whether this is an issue with jedi itself or not - it seems the code in jedi does not take into account the fact that project could be None in this case, or perhaps it does not do that becuase that's not how its clients are supposed to behave.

Jedi's behaviour in 0.17 changed, the sys_path argument to Script is deprecated, and they now expect you to supply a project

https://github.com/davidhalter/jedi/blob/master/jedi/api/__init__.py#L132

Rizhiy commented 4 years ago

Would be nice to continue supporting Jedi, MPLS doesn't work on installed packages, which is annoying.

phootip commented 4 years ago

I almost cried trying to fix this error, uninstalled anaconda, reinstalled python, rollbacked to python 3.7 instead of 3.8. Thank you, and it would be nice to fix this or add this to doc

haoqixu commented 4 years ago

It is a bug of Jedi 0.17.0 and the patch has been merged.

davidhalter/jedi/pull/1549

haoqixu commented 4 years ago

coc-python 1.2.12 has switched to the new api introduced by Jedi 0.17.0. Upgrading coc-python to 1.2.12 works well for me.