Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken with pandas completion #248

Closed
petobens opened this issue Feb 15, 2020 · 10 comments · Fixed by #253
Closed

broken with pandas completion #248

petobens opened this issue Feb 15, 2020 · 10 comments · Fixed by #253

Comments

@petobens
Copy link

petobens commented Feb 15, 2020

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
  1. In a new line type pd.D then erase the .D and retype it (this seems to trigger jedi completion)
  2. 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
Copy link
Collaborator

Shougo commented Feb 15, 2020

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

Please report it in jedi issues.

@petobens
Copy link
Author

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

@Shougo
Copy link
Collaborator

Shougo commented Feb 16, 2020

python jedi.

@Shougo
Copy link
Collaborator

Shougo commented Feb 27, 2020

It seems not fixed in the latest jedi.

@petobens
Copy link
Author

The issue is still open: davidhalter/jedi#1506

@nraw
Copy link

nraw commented Feb 29, 2020

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

@Shougo
Copy link
Collaborator

Shougo commented Mar 1, 2020

- `g:deoplete#sources#jedi#ignore_errors`: Ignore jedi errors for completions.
  Default: `0`

Please read the documentation.

@petobens
Copy link
Author

@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
Copy link
Collaborator

Shougo commented Mar 10, 2020

OK. I will try it.

@petobens
Copy link
Author

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants