Shougo / deoplete.nvim

:stars: Dark powered asynchronous completion framework for neovim/Vim8
Other
5.94k stars 295 forks source link

Python Error after updating deoplete to the latest version with dein #1072

Closed puresick closed 4 years ago

puresick commented 4 years ago

Problems summary

After updating deoplete to the latest version, I receive following error when changing into insert mode after restarting neovim:

[deoplete] Traceback (most recent call last):
  File "/home/puresick/.cache/dein/.cache/minimal.vim/.dein/autoload/deoplete/_main.py", line 56, in main
    child.main_loop(stdout)
  File "/home/puresick/.cache/dein/.cache/minimal.vim/.dein/rplugin/python3/deoplete/child.py", line 60, in main_loop
    name = child_in['name']
KeyError: 'name'
Error in child: KeyError('name').  Use :messages / see above for error details.

Expected

No error message and deoplete running like before the update.

Environment Information

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"


 * `:checkhealth` or `:CheckHealth` result(neovim only):

health#deoplete#check

deoplete.nvim

health#nvim#check

Configuration

Performance

Remote Plugins

terminal

health#provider#check

Clipboard (optional)

Python 2 provider (optional)

Python 3 provider (optional)

Ruby provider (optional)

Node.js provider (optional)


## Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

```vim
" Your minimal init.vim/vimrc
set runtimepath+=$HOME/.cache/dein/repos/github.com/Shougo/dein.vim

if dein#load_state('$HOME/.cache/dein')
    call dein#begin('$HOME/.cache/dein')
    call dein#add('$HOME/.cache/dein/repos/github.com/Shougo/dein.vim')

    call dein#add('Shougo/deoplete.nvim')

    " required
    call dein#end()
    call dein#save_state()
endif

let g:deoplete#enable_at_startup = 1

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Start neovim
  2. update deoplete to latest version (in my case with dein => :call dein:update()
  3. Restart neovim
  4. enter inster mode
  5. Receive error message
kdheepak commented 4 years ago

I get the same error with vim-plug, so it's not an issue with dein.

kdheepak commented 4 years ago

I'm also able to confirm that it works in tagged version 5.2. So this change:

https://github.com/Shougo/deoplete.nvim/compare/5.2...master#diff-e700726088c6524226eff1c59ca1b06b

or this change:

https://github.com/Shougo/deoplete.nvim/compare/5.2...master#diff-ef1297544d28470bc7abb3da4b2c5541

is probably the culprit. For vim-plug users, I ran cd ~/.local/share/nvim/plugged/deoplete.nvim && git checkout 5.2.

qbsc commented 4 years ago

Same here as another vim-plug user. I've reverted to 5.2 for the time being.

inspiralpatterns commented 4 years ago

Same here with neovim -- reverted to 5.2

ryanmorillo commented 4 years ago

pip installing msgpack seems to fix it (had to use pip3)

puresick commented 4 years ago

Using pip3 to install/update msgpack resolved it for me with current HEAD / latest commit. I checked the Arch Linux repository package, which is still on 0.6.2., and their Github, where the 1.0.0 tag is hidden because 0.6.2. is still marked as stable release.

TheNetAdmin commented 4 years ago

Using pip3 to install/update msgpack resolved it for me with current HEAD / latest commit. I checked the Arch Linux repository package, which is still on 0.6.2., and their Github, where the 1.0.0 tag is hidden because 0.6.2. is still marked as stable release.

You are right, the pacman -Qi python-msgpack gives 0.6.2. But pip can find version 1.0.0. To install 1.0.0 on Arch:

sudo pip3 install msgpack -U

If anyone happens to uninstall the msgpack first with pip uninstall msgpack which makes pip install doesn't work anymore:

❯ pip install msgpack
Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    load_entry_point('pip==19.3', 'console_scripts', 'pip')()
  File "/usr/lib/python3.8/site-packages/pip/_internal/main.py", line 45, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/usr/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
    module = importlib.import_module(module_path)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 24, in <module>
    from pip._internal.cli.req_command import RequirementCommand
  File "/usr/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 20, in <module>
    from pip._internal.network.session import PipSession
  File "/usr/lib/python3.8/site-packages/pip/_internal/network/session.py", line 18, in <module>
    from pip._vendor.cachecontrol import CacheControlAdapter
ModuleNotFoundError: No module named 'pip._vendor.cachecontrol'

You can use sudo pacman -S python-msgpack to reinstall this package, and then use pip to install the 1.0.0 version.

dkvasnicka commented 4 years ago

Upgrading msgpack to 1.0.0 screwed things even more for me (macOS 10.14, Deoplete failed to load completely, citing something missing... forgot to copy the :messages output, sorry), probably because of other things I have installed that depend on old msgpack...?

I had to go the git checkout 5.2 route and stick to msgpack==0.5.6. YMMV.

Shougo commented 4 years ago

I have improved msgpack version check when initialize.

Shougo commented 4 years ago

@dkvasnicka I don't know, but other library may be needed old msgpack. It is not deoplete problem.

Shougo commented 4 years ago

Why I need to update for latest msgpack. https://github.com/Shougo/deoplete.nvim/issues/1071

Cypher1 commented 4 years ago

For the record: I had the same problem and while deoplete told me I needed to install msgpack, it didn't tell me that I needed to install pynvim.

Please fix the error message so that it detects both missing dependencies.

Note: Here's the relevant pip command for others having the same issue.

pip3 install --user pynvim
Shougo commented 4 years ago

@Cypher1 Sorry, it is already documented and deoplete checks Python3 support (and nvim-yarp in Vim8).

They requires pynvim package. So I don't add the check. Why don't you read the documentation???

Cypher1 commented 4 years ago

@Shougo I have a bunch of plugins that all upgraded at the same time. Googling the message got me here (not to the documentation). I installed the package that you explained was needed and it wasn't enough (hence my comment asking for the error message to check that pynvim is installed, not just python3 or msgpack).

It's not because I can't read the documentation, it's because I don't want configuring vim/nvim to waste people's time.

Shougo commented 4 years ago

It's not because I can't read the documentation, it's because I don't want configuring vim/nvim to waste people time.

Wow.

Shougo commented 4 years ago

It is OK to add the message if other people complain it.

dkvasnicka commented 4 years ago

@Shougo Would it be possible to use a separate Python virtualenv just for this plugin (as opposed to Nvim as a whole) and how? That would fix the problem with other plugins depending on older version of msgpack, right?

Shougo commented 4 years ago

For Vim8 https://vi.stackexchange.com/questions/18574/how-do-i-configure-the-python-location

Shougo commented 4 years ago

For neovim, g:python3_host_prog variable.