deoplete-plugins / deoplete-jedi

deoplete.nvim source for Python
MIT License
588 stars 40 forks source link

broken with pandas completion #248

Closed petobens closed 4 years ago

petobens commented 4 years ago

Consider the following minimal init.vim file:

let $DOTVIM = expand('$HOME/.config/nvim')

set runtimepath+=$DOTVIM/bundle/repos/github.com/Shougo/deoplete.nvim
set runtimepath+=$DOTVIM/bundle/repos/github.com/deoplete-plugins/deoplete-jedi
filetype plugin indent on

let g:deoplete#enable_at_startup = 1
let g:deoplete#sources#jedi#python_path = '/usr/bin/python'

Now do the following:

  1. Open a foo.py with the following content:
    import pandas as pd
  2. In a new line type pd.D then erase the .D and retype it (this seems to trigger jedi completion)
  3. After 2. I get the following error:
    [deoplete] Traceback (most recent call last):
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/api/completion_cache.py", line 15,
    in _get_from_cache
    return _cache[module_name][name][number]
    KeyError: 'NamedAgg'
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
    File "/home/pedro/.config/nvim/bundle/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/child.py", line 189, in _gather_results
    result = self._get_result(context, source)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/child.py", line 249, in _get_result
    ctx['candidates'] = source.gather_candidates(ctx)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 37, in wrapp
    er
    return func(self, *args, **kwargs)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 195, in gather_candid
    ates
    return self.finalize_completions(completions)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 37, in wrapp
    er
    return func(self, *args, **kwargs)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 144, in finalize_comp
    letions
    out.append(self.parse_completion(c, tmp_filecache))
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 305, in parse_complet
    ion
    type_ = comp.type
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/api/classes.py", line 624, in type
    return completion_cache.get_type(
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/api/completion_cache.py", line 17,
    in _get_from_cache
    v = get_cache_values()
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/api/classes.py", line 627, in <lam
    bda>
    lambda: self._get_cache()
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/api/classes.py", line 616, in _get
    _cache
    super(Completion, self)._get_docstring_signature(),
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/api/classes.py", line 262, in _get
    _docstring_signature
    for signature in self._get_signatures(for_docstring=True)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/api/classes.py", line 504, in _get
    _signatures
    names = convert_names([self._name], prefer_stubs=True)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/inference/gradual/conversion.py",
    line 138, in convert_names
    return _python_to_stub_names(names, fallback_to_python=prefer_stubs)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/inference/utils.py", line 20, in w
    rapper
    return list(func(*args, **kwargs))
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/inference/gradual/conversion.py",
    line 106, in _python_to_stub_names
    values = convert_values(n.infer(), only_stubs=True)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/inference/gradual/conversion.py",
    line 148, in convert_values
    return ValueSet.from_sets(
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/common/value.py", line 32, in from
    _sets
    for set_ in sets:
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/inference/gradual/conversion.py",
    line 149, in <genexpr>
    to_stub(value)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/inference/gradual/conversion.py",
    line 170, in to_stub
    stub_module = _load_stub_module(value.get_root_context().get_value())
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/inference/gradual/conversion.py",
    line 85, in _load_stub_module
    return _try_to_load_stub_cached(
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/inference/gradual/typeshed.py", li
    ne 141, in _try_to_load_stub_cached
    _try_to_load_stub(inference_state, import_names, *args, **kwargs)
    File "/home/pedro/.config/nvim/bundle/repos/github.com/deoplete-plugins/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/inference/gradual/typeshed.py", li
    ne 153, in _try_to_load_stub
    if parent_module_value is None and len(import_names) > 1:
    TypeError: object of type 'NoneType' has no len()
    Error from jedi: object of type 'NoneType' has no len().  Use :messages / see above for error details.

    For the record I'm on arch linux using python3.8, pandas 1.0.1 and latest master versions of deoplete and deoplete-jedi

Shougo commented 4 years ago

OK. Reproduced. But this is not deoplete-jedi's issue. It is jedi's issue.

Please report it in jedi issues.

petobens commented 4 years ago

Do you mean in vim-jedi or in python jedi?

Shougo commented 4 years ago

python jedi.

Shougo commented 4 years ago

It seems not fixed in the latest jedi.

petobens commented 4 years ago

The issue is still open: https://github.com/davidhalter/jedi/issues/1506

nraw commented 4 years ago

is there a way to suppress it for now at least?

Shougo commented 4 years ago
- `g:deoplete#sources#jedi#ignore_errors`: Ignore jedi errors for completions.
  Default: `0`

Please read the documentation.

petobens commented 4 years ago

@Shougo this has been fixed in latest jedi... do you need to update the jedi submodule? (don't know if deoplete-jedi uses one)

Shougo commented 4 years ago

OK. I will try it.

petobens commented 4 years ago

Thank you