I just upgraded my anaconda mode package on my emacs ,which was running smoothly with jedi 0.9.0. My python version is 3.6.0.
Since there is no release on pypi, I installed jedi manually:
git clone https://github.com/davidhalter/jedi
cd jedi
git checkout v0.10.0
python setup.py sdist
cd dist
PYTHONPATH=$HOME/.emacs.d/anaconda-mode/0.1.7 easy_install -d $HOME/.emacs.d/anaconda-mode/0.1.7 -S $HOME/.emacs.d/anaconda-mode/0.1.7 -a -Z jedi-0.10.0.tar.gz
But after the upgrade jedi 0.10.0 keeps crashing when I type almost anything. Here is the stack trace:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/service_factory/service.py", line 101, in apply
result = method(**params)
File "/home/robin/.emacs.d/.cache/anaconda-mode/0.1.7/anaconda_mode-0.1.7-py3.6.egg/anaconda_mode.py", line 27, in wrapper
return f(Script(source, line, column, path))
File "/home/robin/.emacs.d/.cache/anaconda-mode/0.1.7/anaconda_mode-0.1.7-py3.6.egg/anaconda_mode.py", line 49, in wrapper
for definition in f(script)]
File "/home/robin/.emacs.d/.cache/anaconda-mode/0.1.7/anaconda_mode-0.1.7-py3.6.egg/anaconda_mode.py", line 49, in <listcomp>
for definition in f(script)]
File "/home/robin/.emacs.d/.cache/anaconda-mode/0.1.7/jedi-0.10.0-py3.6.egg/jedi/api/classes.py", line 301, in full_name
path = list(self._path())
File "/home/robin/.emacs.d/.cache/anaconda-mode/0.1.7/jedi-0.10.0-py3.6.egg/jedi/api/classes.py", line 180, in _path
return reversed(list(to_reverse()))
File "/home/robin/.emacs.d/.cache/anaconda-mode/0.1.7/jedi-0.10.0-py3.6.egg/jedi/api/classes.py", line 161, in to_reverse
module_context, = name.infer()
ValueError: not enough values to unpack (expected 1, got 0)
For me, it occurs on almost any code. A minimal case is import os.p. Is this related to jedi or something else?
And I found another issue here: https://github.com/proofit404/anaconda-mode/issues/224
Thanks!
Hmm that is interesting. Maybe full_name is bugged and there's not enough tests for it.
I also get this error, but only for imported libraries (I think). So, for example, I get completions for list methods, but I receive the mentioned error when trying to complete numpy methods. As for the OP this worked with jedi 0.9.
+1 on this, my remote anaconda minserver was crashing, downgrading from 0.10 to 0.9 fixed it.
+1, Emacs's anaconda-mode was bugging out because of it, downgraded Jedi to 0.9.
I have fixed the os.path case. Please test on the dev branch. I'm not sure at all if this solves all the issues. I'm closing but happy to either reopen or see new tickets. I'm writing regression tests, which will definitely improve the situation if you report.
I think it works now. Thanks!
I'm still seeing this issue on dev branch (seems to be the same as #907 and #908). Running the example code from #908:
import jedi
s = jedi.Script('''import os
os.''', 2, len('os.'))
s.completions()
for c in s.completions():
print(c.name, c.full_name)
results in
Traceback (most recent call last):
File "test_jedi.py", line 6, in <module>
print(c.name, c.full_name)
File "/Users/victor/code/src/jedi-dev/jedi/api/classes.py", line 299, in full_name
path = list(self._path())
File "/Users/victor/code/src/jedi-dev/jedi/api/classes.py", line 181, in _path
return reversed(list(to_reverse()))
File "/Users/victor/code/src/jedi-dev/jedi/api/classes.py", line 162, in to_reverse
module_context, = name.infer()
ValueError: not enough values to unpack (expected 1, got 0)
In practice, this happens when I try to import non-builtin modules in Spacemacs (similar to #907).
I had this issue using jedi on windows via spacemacs, resolved by downgrading to 0.9.0
I tried to investigate this problem since it happens to me as well. As it was ok for some imports but not in some others, I used following code to find out where exactly full_name method is raising errors:
import jedi
s = jedi.Script('''import os
os.''', 2, len('os.'))
for item in s.completions():
try:
item.full_name
except Exception as e:
print(item.name, e)
And here is the result:
$ python test.py
ce not enough values to unpack (expected 1, got 0)
nt not enough values to unpack (expected 1, got 0)
_exit not enough values to unpack (expected 1, got 0)
_have_functions not enough values to unpack (expected 1, got 0)
So I tried to figure out what is going on in Python os module and it looks like these imports shouldn't happen if ne is not available in sys.builtin_module_names! So if we don't have the module, infer_import from evaluates/imports.py will send back an empty set and this will cause module_context, = name.infer() in api/classes.py to raise ValueError.
For now, I've fixed this problem as you can see in my fork, but I'm not sure if this is the best way to cover this issue.
@shahinism What you did is not fixing the issue but hiding it.
Any progress?
I can't believe this issue is going on for a few months and no action has been taken to fix the issue, @davidhalter do have any plans?
@k1-hedayati Fix it. It's open source. I'm happy to QA pull requests.
I have other priorities at the moment.
But nice to see an Iranian guy here :) Zenda Bashi
I've investigated a similar issue with numpy.
Trying to complete the following:
import numpy as np
np.|
gives the same error.
I tracked it to the line https://github.com/davidhalter/jedi/blob/master/jedi/api/classes.py#L162
name.infer() returns {} which leads to the ValueError.
I don't know enough about how jedi works to propose a fix yet.
This happens e.g. on the numpy.bool_ completion.
@davidhalter I think hiding the issue by using a "fix" like that proposed by @shahinism would be progress already since this issue ruins the autocompletion experience for a lot of people.
A release is coming soon! #961
Still getting a similar error with neovim and deoplete-jedi:
rv = function(obj, *args, **kwargs)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/__init__.py", line 237, in _eval_element_cached
return eval_node(context, element)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/debug.py", line 82, in wrapper
return func(*args, **kwargs)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/syntax_tree.py", line 51, in wrapper
return func(context, *args, **kwargs)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/syntax_tree.py", line 149, in eval_node
return eval_or_test(context, element)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/syntax_tree.py", line 361, in eval_or_test
context.eval_node(right))
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/base_context.py", line 81, in eval_node
return self.evaluator.eval_element(self, node)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/__init__.py", line 221, in eval_element
return self._eval_element_if_evaluated(context, element)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/__init__.py", line 233, in _eval_element_if_evaluated
return self._eval_element_cached(context, element)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/cache.py", line 42, in wrapper
rv = function(obj, *args, **kwargs)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/__init__.py", line 237, in _eval_element_cached
return eval_node(context, element)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/debug.py", line 82, in wrapper
return func(*args, **kwargs)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/syntax_tree.py", line 51, in wrapper
return func(context, *args, **kwargs)
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/syntax_tree.py", line 124, in eval_node
return ContextSet([compiled.builtin_from_name(evaluator, u'Ellipsis')])
File "/Users/viovene/.local/share/nvim/plugged/deoplete-jedi/rplugin/python3/deoplete/vendored/jedi/jedi/evaluate/compiled/__init__.py", line 15, in builtin_from_name
context, = name.infer()
ValueError: not enough values to unpack (expected 1, got 0)
Error from jedi: not enough values to unpack (expected 1, got 0). Use :messages / see above for error details.
@tgy Please post it as a new issue. It's definitely something different, the code base has changed a lot. Please also post version information of Jedi and Python. Also check that the typeshed submodule is checked out, which might not be the case here.
Most helpful comment
A release is coming soon! #961