anaconda
anaconda copied to clipboard
Anaconda autocomplete
Anaconda autocomplete is not working. I am on Linux and my Sublime Text 3 recently updated. Prior to the update it worked fine. I update via the Package Manager. ST version 4121. Latest Anaconda version. I tried uninstalling and reinstalling but it didn't help.
I don't get any errors. Here is the most recent error in my jsonserver log: 021-11-30 15:23:57,206: ERROR : Traceback (most recent call last): File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/cache.py", line 109, in wrapper return dct[key] KeyError: ((), frozenset())
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/jsonserver.py", line 112, in found_terminator self.handle_command(handler_type, method, uid, vid, settings, data) File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/jsonserver.py", line 140, in handle_command handler(method, data, uid, vid, settings, self.return_back, DEBUG_MODE).run() File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/handlers/jedi_handler.py", line 29, in run super(JediHandler, self).run() File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/lib/anaconda_handler.py", line 49, in run command(**kwargs) File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/handlers/jedi_handler.py", line 99, in doc Doc(self.callback, self.uid, self.script, html) File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/handlers/jedi_handler.py", line 45, in script return self.jedi_script(**self.data) File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/handlers/jedi_handler.py", line 53, in jedi_script return jedi.Script( File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/api/init.py", line 184, in init self._inference_state = InferenceState( File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/inference/init.py", line 91, in init self.grammar = environment.get_grammar() File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/cache.py", line 111, in wrapper result = method(self, *args, **kwargs) File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/api/environment.py", line 37, in get_grammar return parso.load_grammar(version=version_string) File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/parso/grammar.py", line 260, in load_grammar return load_grammar(**kwargs) File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/parso/grammar.py", line 236, in load_grammar version_info = parse_version_string(version) File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/parso/utils.py", line 176, in parse_version_string return _parse_version(version) File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/parso/utils.py", line 125, in _parse_version raise ValueError('The given version is not in the right format. ' ValueError: The given version is not in the right format. Use something like "3.8" or "3".
I'm running Python 3.10.
I am a bit confused, you said that you are using ST3 but the version you are using is for ST4. There was a patch added to prevent the plugin from triggering auto-completion when typing :
or '
in ST4, it should not affect ST3 and definitely it should not affect regular .
(dot) completion, try to downgrade to the previous version of anaconda to see if the problem goes away, update this thread with the results please
My bad, DamnWidget. I'm using ST4 (The latest ST--I thought it was 3). Autocomplete does not work at all for me.
I think I may be partially mistaken. Autocomplete does work to a degree. Did you change code so that it does not fetch functions and methods after a . (dot)? I've noticed that it works for things like function/method references and definitions, but not for things like this:
- if I type "import o", it used to retrieve modules and offer autocomplete for them like "os". It doesn't now.
- If I type "os.", it used to retrieve functions and definitions that are a part of the os module like "os.scandir". It doesn't now.
To my understanding nothing related with the auto-completion results have been changed since way back no
It must be a system thing then. I tried uninstalling and reinstalling, but that didn't help. I don't know what else to do. Here's a recent log:
2021-12-05 11:56:43,383: ERROR : Traceback (most recent call last):
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/cache.py", line 109, in wrapper
return dct[key]
KeyError: ((), frozenset())
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/jsonserver.py", line 112, in found_terminator
self.handle_command(handler_type, method, uid, vid, settings, data)
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/jsonserver.py", line 140, in handle_command
handler(method, data, uid, vid, settings, self.return_back, DEBUG_MODE).run()
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/handlers/jedi_handler.py", line 29, in run
super(JediHandler, self).run()
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/lib/anaconda_handler.py", line 49, in run
command(**kwargs)
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/handlers/jedi_handler.py", line 99, in doc
Doc(self.callback, self.uid, self.script, html)
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/handlers/jedi_handler.py", line 45, in script
return self.jedi_script(**self.data)
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_server/handlers/jedi_handler.py", line 53, in jedi_script
return jedi.Script(
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/api/__init__.py", line 184, in __init__
self._inference_state = InferenceState(
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/inference/__init__.py", line 91, in __init__
self.grammar = environment.get_grammar()
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/cache.py", line 111, in wrapper
result = method(self, *args, **kwargs)
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/api/environment.py", line 37, in get_grammar
return parso.load_grammar(version=version_string)
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/parso/grammar.py", line 260, in load_grammar
return load_grammar(**kwargs)
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/parso/grammar.py", line 236, in load_grammar
version_info = parse_version_string(version)
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/parso/utils.py", line 176, in parse_version_string
return _parse_version(version)
File "/home/malonn/.config/sublime-text/Packages/Anaconda/anaconda_lib/parso/utils.py", line 125, in _parse_version
raise ValueError('The given version is not in the right format. '
ValueError: The given version is not in the right format. Use something like "3.8" or "3".
What's that ValueError? Related to my Python version. It's 3.10 (the latest) and he file is named 'python3.10'. Should I rename and test? I guess I will try.
Hi i have the same problem in SublimeText for python 3.10, but in Windows. As a temporary solution i changed function "_parse_version" in the file C:\Program Files\sublime_text_build_4121_x64\Data\Packages\Anaconda\anaconda_lib\parso\utils.py like this:
def _parse_version(version):
major = 3
minor = 8
return PythonVersionInfo(major, minor)
autocomplete working again
Great tip. Thanks. I took a cursory look at the error and was planning on fixing it, but it looks like you beat me to it. I will do as you did and see what comes of it. Thanks. @DIM-KO .
I just had surgery (writing from he hospital actually) will take a bit of time until I can look into this stuff, if you find workarounds for this , please share them with the community I will be out for like three weeks. Also provide the most data you can also PRs will be very welcome.
Regards
I'm looking at it now, @DamnWidget . I have never done any work with RegEx, so will have to brush up on syntax and such. @DIM-KO 's fix is not 1-for-1, so I have to dig a little. Also, I'm not familiar with the acronym "PR". The only thing that comes to mind is "Public Relations". I hope all goes well for you post surgery.
Hi, PR stand for Pull Request, thanks, I also hope everything goes well :)
Alright. I was able to solve the RegEx matching problem, but it looks like you need to add support for Python 3.10, @DamnWidget I don't know what all goes into adding support for a new version. In the meantime, I think I'm going to trick Anaconda into thinking my Python version is 3.8. Is 3.9 supported?
Answered my own question. 3.9 is supported.
Solution: Step 1: copy the file ...\ Sublime_text \ Data \ Packages \ Anaconda \ anaconda_lib \ parso \ python \ grammar39.txt and rename to grammar310.txt Step 2: change function "_parse_version" in the file .. \ sublime_text \ Data \ Packages \ Anaconda \ anaconda_lib \ parso \ utils.py like this:
def _parse_version(version):
match = re.match(r'(\d+)(?:\.(\d+)(?:\.\d+)?)?$', version)
Regards
Thanks, @DIM-KO I figured out the RegEx issue and but not the renaming of "grammar39". Still, @DamnWidget needs to update the package when he is well because renaming the "grammarxx.txt" drops support for Python 3.9. I will try to add a new file named "grammar310.txt" and see if that fixes the issue.
EDIT: Oops, misread your comment. You did copy grammar39.txt and rename. My fault. Still, @DamnWidget needs to add support for anything new in Python 3.10.
@DamnWidget you, probably, should mention somewhere (RAEDME maybe?) that 3.10 is not supported. I spent too much time to find that out on my own.