deoplete-plugins / deoplete-jedi

deoplete.nvim source for Python
MIT License
589 stars 39 forks source link

Error from jedi: __init__() got an unexpected keyword argument 'code' #270

Closed eInyzant closed 3 years ago

eInyzant commented 3 years ago

Problems summary

When I start typing anything I got pleinty of errors, after what the plugin says it is disabled until restart.

Expected

When I start typing, I should see the popup for completion

Environment Information

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

     fichier vimrc système : "$VIM/sysinit.vim"
           $VIM par défaut : "/usr/share/nvim"

Run :checkhealth for more info

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!)

" Your minimal init.vim/vimrc
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
call plug#begin('~/.vim/plugged')
if has('nvim')
  Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
  Plug 'Shougo/deoplete.nvim'
  Plug 'roxma/nvim-yarp'
  Plug 'roxma/vim-hug-neovim-rpc'
endif
Plug 'deoplete-plugins/deoplete-jedi'
call plug#end()

filetype plugin indent on     " required!

" General {
    set fileencoding=utf-8 " Encodage des caractères pour les fichiers
    set enc=utf-8       " Encodage utilisé par vim (conversion effectué si différent de fileencoding)
    set tenc=utf-8  " Encodage utilisé par vim (conversion effectué si différent de fileencoding)
    syntax on                   " syntax highlighting
    set mouse=a                 " automatically enable mouse usage
    set fileformat=unix

" Key Mappings {

    " Yank from the cursor to the end of the line, to be consistent with C and D.
    nnoremap Y y$
    let mapleader=","

" }

" Plugins {

  " Deoplete {
    let g:deoplete#enable_at_startup = 1
  "}

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

  1. Open a python file
  2. Start typing anything in insertion mode
  3. => errors

Upload the log file

[deoplete] Traceback (most recent call last):                                                                                  
  File "/home/erwan/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 194, in _gather_results
    result = self._get_result(context, source)
  File "/home/erwan/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 254, in _get_result
    ctx['candidates'] = source.gather_candidates(ctx)
  File "/home/erwan/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 37, in wrapper
    return func(self, *args, **kwargs)
  File "/home/erwan/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 199, in gather_candidates
    script = self.get_script(source, filename, environment=self._env)
  File "/home/erwan/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 37, in wrapper
    return func(self, *args, **kwargs)
  File "/home/erwan/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 144, in get_script
    return self._jedi.Script(code=source, path=filename, environment=self._env)
TypeError: __init__() got an unexpected keyword argument 'code'
Error from jedi: __init__() got an unexpected keyword argument 'code'.  Use :messages / see above for error details.
[deoplete] Traceback (most recent call last):
  File "/home/erwan/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 194, in _gather_results
    result = self._get_result(context, source)
  File "/home/erwan/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 254, in _get_result
    ctx['candidates'] = source.gather_candidates(ctx)
  File "/home/erwan/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 37, in wrapper
    return func(self, *args, **kwargs)
  File "/home/erwan/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 199, in gather_candidates
    script = self.get_script(source, filename, environment=self._env)
  File "/home/erwan/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 37, in wrapper
    return func(self, *args, **kwargs)
  File "/home/erwan/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 144, in get_script
    return self._jedi.Script(code=source, path=filename, environment=self._env)
TypeError: __init__() got an unexpected keyword argument 'code'
Error from jedi: __init__() got an unexpected keyword argument 'code'.  Use :messages / see above for error details.
Shougo commented 3 years ago

I don't reproduce your error.

The code argument is exists. So your jedi is very old. https://github.com/davidhalter/jedi/blob/master/jedi/api/__init__.py#L108

What is your jedi's version??

Shougo commented 3 years ago

You should execute pip3 install --upgrade jedi in command line.

eInyzant commented 3 years ago

@Shougo Thank you you were right. In fact I think jedi was installed a long time ago on my computer and when I ran this command pip3 install --user jedi from the README, it probably did nothing, just telling me that jedi is already installed. Maybe you could add a notice on your README.

Thank you again for your time :)

Shougo commented 3 years ago

OK. I have updated it.