pappasam / coc-jedi

coc.nvim wrapper for https://github.com/pappasam/jedi-language-server
MIT License
229 stars 9 forks source link

[coc.nvim] error: UnhandledRejection: Launching server 'jedi" #1

Closed no120030 closed 4 years ago

no120030 commented 4 years ago

Hello!

I have an error saying:

[coc-nvim] error: UnhandledRejection: Launching server "jedi" using command /home/*MyName*/.config/coc/extensions/node_modules/coc-jedi/.venv/bin/jedi-language-server failed.

I checked the directory above and could not find .venv folder. There are only:

it seems like 'jedi-language-server' is not automatically installed in its virtualenv.

I am using python 3.8.2, virtualenv 20.0.18, and vim 8.2. My virtual environment' pip list is:

Package           Version
----------------- -------
-                 p
-ip               20.1
astroid           2.4.1
click             7.1.2
collections2      0.3.0
cycler            0.10.0
isort             4.3.21
kiwisolver        1.2.0
lazy-object-proxy 1.4.3
matplotlib        3.2.1
mccabe            0.6.1
numpy             1.18.4
parso             0.7.0
pip               20.1
pygls             0.9.0
pylint            2.5.2
pyparsing         2.4.7
python-dateutil   2.8.1
setuptools        46.2.0
six               1.14.0
toml              0.10.0
wheel             0.34.2
wrapt             1.12.1

I am not sure whether or not the log is helpful, but here is mine:

 2020-05-13T02:09:32.459 INFO (pid:5304) [services] - registered service "jedi"
 2020-05-13T02:09:32.461 INFO (pid:5304) [services] - jedi-language-server state change: stopped => starting
 2020-05-13T02:09:32.463 INFO (pid:5304) [plugin] - coc 0.0.78-3f305ac739 initialized with node: v14.2.0
 2020-05-13T02:09:32.467 INFO (pid:5304) [services] - jedi-language-server state change: starting => stopped
 2020-05-13T02:09:32.486 ERROR (pid:5304) [services] - Server jedi failed to start: Launching server "jedi" using command /home/*MyName*/.config/coc/extensions/node_modules/coc-jedi/.venv/bin/jedi-    language-server failed.
 2020-05-13T02:09:32.487 ERROR (pid:5304) [language-client-index] - Error: spawn /home/*MyName*/.config/coc/extensions/node_modules/coc-jedi/.venv/bin/jedi-language-server ENOENT
     at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
     at onErrorNT (internal/child_process.js:468:16)
     at processTicksAndRejections (internal/process/task_queues.js:84:21) {
   errno: -2,
   code: 'ENOENT',
   syscall: 'spawn /home/*MyName*/.config/coc/extensions/node_modules/coc-jedi/.venv/bin/jedi-language-server',
   path: '/home/*MyName*/.config/coc/extensions/node_modules/coc-jedi/.venv/bin/jedi-language-server',
   spawnargs: []
 }
 2020-05-13T02:09:32.488 ERROR (pid:5304) [server] - unhandledRejection  Promise {
   <rejected> 'Launching server "jedi" using command /home/*MyName*/.config/coc/extensions/node_modules/coc-jedi/.venv/bin/jedi-language-server failed.'
 } Launching server "jedi" using command /home/*MyName*/.config/coc/extensions/node_modules/coc-jedi/.venv/bin/jedi-language-server failed.               

Could you help me to solve this issue?

Sorry for the messy post. It seems like I am throwing a bunch of random information.

kashewnuts commented 4 years ago

I think this change is a problem. https://github.com/pappasam/coc-jedi/commit/1e157b60cf1498fc7b2a277c5da7f5ed4c9c6c04#diff-00c1c5bdcf93d16c502f067af37d2428R12 It should be python3 command instead of python command.

p.s. The python command often works with the Python2 series. However, the Python2 series does not have a venv module, so the .venv directory is not created. https://docs.python.org/3/library/venv.html

no120030 commented 4 years ago

@kashewnuts Can I just change it into python3?

It seems it needs more steps :(

btw, thank you so much for the quick response

pappasam commented 4 years ago

Should be resolved in the latest release!

no120030 commented 4 years ago

It is not resolved, and the issue is still the same. :(

pappasam commented 4 years ago

Interesting, it seems like :CocInstall doesn't seem to run npm postinstall hooks. This is either a bug or a feature, I'm not sure which at this moment.

@no120030 as a temporary workaround, please put the following in your coc-settings.json:

{
  "jedi.executable.command": "jedi-language-server",
}

As long as jedi-language-server is in your path, things should work as before.

pappasam commented 4 years ago

Alternatively, if you manage coc-jedi with your Vim package manager according to these instructions, things should work out of the box right now!

no120030 commented 4 years ago

@pappasam Thank you so much! The first method works like a charm. I also tried installing coc-jedi with vim-plug, but it gave me another error saying:

[coc.nvim] extension "coc-jedi" doesn't contain main file /home/MyName/.vim/plugged/coc-jedi/lib/index.js.

For now, I will stick to the first solution. Again, Thank you for your help.

pappasam commented 4 years ago

@no120030 that error often occurs during the installation process (before yarn install has a chance to finish) and will happen for most coc extensions installed with the vim plugin manager method. Just ignore it until vim-plug finishes running and things should work normally.

I've opened an issue with coc.nvim, we'll see what the author has to say!

pappasam commented 4 years ago

@no120030 ok, this issue should be resolved for real in the latest release 0.8.0. Please test it out and let me know if a :CocInstall'd coc-jedi is working correctly for you too!

no120030 commented 4 years ago

@pappasam It works without specifying jedi.executable.command!!! Thank you so much! everything is working so fine as before. I appreciate your help.

g-i-o-r-g-i-o commented 4 years ago

still the same problem

robotlightsyou commented 3 years ago

@GianniGi Were you ever to get this working? I'm getting the same error and not finding anything as a workaround, and my settings-coc.json already has the line about "jedi.executable.command": "jedi-language-server".

pappasam commented 3 years ago

@robotlightsyou This particular issue has been resolved for a while. Given the diversity of Python environments / setups (OS, conda/pypi, etc), I can't provide much help to you without more information about your particular setup. Other people have had trouble with their initial setup over the past couple of months and resolutions have been found in the following issues:

If you're unable to resolve your setup issues by reading the above issues, please provide me some information about your environment (OS, Python version, how you install coc-jedi, whether you've explicitly installed jedi-language-server, etc).

tdillenburg commented 3 years ago

@robotlightsyou I believe you need to remove "jedi.executable.command": "jedi-language-server" from settings-coc.json

robotlightsyou commented 3 years ago

@pappasam @TiagoDillenburg The issue was that I had never pip installed jedi-language-server. Once I ran that and confirmed settings-coc.json everything ran fine. Thanks for the assistance.

augustfengd commented 3 years ago

Just sharing:

On my machine, I had to install the python3.8-venv package in order for things to work.