codota / tabnine-vim

Vim client for TabNine. https://vimawesome.com/plugin/tabnine-vim
https://www.tabnine.com/install/vim
GNU General Public License v3.0
669 stars 36 forks source link

Broken on python 3.10 #107

Closed schrotie closed 2 years ago

schrotie commented 2 years ago

Tabnine does not work with python 3.10. I followed the suggestion in the related (closed) issue but that does not work for me. I'm on Manjaro (Arch based) Linux. python: 3.10.1 vim: 8.2.4106

I'm not using pathogen, vundle or some such thing but the built-in native package loading of vim 8.

As recommended here I installed https://github.com/tabnine/YouCompleteMe (in ~/.vim/pack/schrotie/start/YouCompleteMe and did python3 install.py --all there) successfully.

I also switched ~/.vim/pack/schrotie/start/tabnine-vim to the python3 branch. I tried calling the install script there. install.sh says it's deprecated and complains that urllib3 is missing (which is installed). python3 install.py fails with:

Traceback (most recent call last):
  File "/home/schrotie/.vim/pack/schrotie/start/tabnine-vim/third_party/ycmd/build.py", line 50, in <module>
    import requests
  File "/home/schrotie/.vim/pack/schrotie/start/tabnine-vim/third_party/ycmd/third_party/requests/requests/__init__.py", line 134, in <module>
    from . import packages
ImportError: bad magic number in 'requests.packages': b'\x03\xf3\r\n'

When I then start vim I get a ton of errors. However, I'm not sure if it prints all problems ... there's quite some traces. Some are:

AttributeError: type object 'BaseRequest' has no attribute 'session'. Did you mean: 'Session'?
ImportError: bad magic number in 'requests.packages': [...]
E858: Eval did not return a valid python object

Originally posted by @schrotie in https://github.com/codota/tabnine-vim/issues/103#issuecomment-1022046518

gz#11533

bilucodota commented 2 years ago

Hi @schrotie .. can you clarify what happens exactly after you install tabnine/YouCompleteMe and open vim?

schrotie commented 2 years ago

Hi @bilucodota, thanks for your reply! I started vim with logging enabled and attached the log here: vim.log Note that this only occurs when I have the tabnine package on its python3 branch, not on master. I started gvim and the errors go in a loop, thus I have to kill it.

bilucodota commented 2 years ago

@schrotie can you try to delete all .pyc files on your cloned repo? `find . -name ".pyc" -delete`

schrotie commented 2 years ago

@bilucodota That did it, thanks a lot! Steps taken in the tabnine repo (with tabnine-ycm installed):

git checkout python3
find . -name "*.pyc" -delete
python3 install.py 

Then started vim, tabnine not working, did :YcmRestartServer and now it works again. Thanks! Please feel free to close this issue.

marslo commented 2 years ago

@bilucodota That did it, thanks a lot! Steps taken in the tabnine repo (with tabnine-ycm installed):

git checkout python3
find . -name "*.pyc" -delete
python3 install.py 

Then started vim, tabnine not working, did :YcmRestartServer and now it works again. Thanks! Please feel free to close this issue.

works for me on vim 9.0. details:

$ vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jul 12 2022 19:54:35)
macOS version - x86_64
Included patches: 1-49
...

$ sw_vers 
ProductName:    macOS
ProductVersion: 12.4
BuildVersion:   21F79

$ python --version
Python 3.10.4

$ pip --version
pip 22.0.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)

issue :

YouCompleteMe unavailable: module 'collections' has no attribute 'Mapping'