ycm-core / ycmd

A code-completion & code-comprehension server
https://ycm-core.github.io/ycmd/
GNU General Public License v3.0
1.7k stars 767 forks source link

Bumdled bottle version no longer works on Python 3.11 #1662

Closed M4rtinK closed 2 years ago

M4rtinK commented 2 years ago

I'm using the Fedora 37 Beta on my machine and I have noticed ycmd fails to start. When debugging the issue, I have got to this traceback:

/usr/bin/python3 ycmd --options_file=default_settings.json
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/mkolman/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/__main__.py", line 53, in <module>
    from ycmd.hmac_plugin import HmacPlugin
  File "/home/mkolman/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/hmac_plugin.py", line 19, in <module>
    from bottle import request, abort, response
  File "/home/mkolman/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 44, in <module>
    from inspect import getargspec
ImportError: cannot import name 'getargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)

This is likely due to the pre-release Python 3.11, where getargspec apparently is no longer available in inspect:

$ python
Python 3.11.0rc2 (main, Sep 13 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat 12.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from inspect import getargspec
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'getargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)

Looking at the docs, 3.11 no longer lists the getargspec but refers to it:

https://docs.python.org/3.11/library/inspect.html

3.10 docs mark it as deprecated:

https://docs.python.org/3.10/library/inspect.html#inspect.getargspec

So while this is pre-release distro & pre-release version of Python, this might still become a bigger issue once more stable distros switch to 3.11, it it indeed means this function is dropped in 3.11.

Also the most likely issue is the bundled bottle is just too old & more recent version might work fine on latest Python versions.

puremourning commented 2 years ago

Pre-release pythons are not supported.

That said, we recently upgraded bottle to the latest. Have you updated ycmd to latest and its submodules?

Duplicate https://github.com/ycm-core/YouCompleteMe/issues/4056

puremourning commented 2 years ago

I just built ycmd with python 3.11.0b3 at the latest commit and it works fine.

Printing YouCompleteMe debug information...
-- Resolve completions: On demand
-- Client logfile: /var/folders/mr/p_8nf2d90gvd72mh012fqlg00000gn/T/ycm_qt__jt_w.log
-- Server Python interpreter: /Users/ben/.pyenv/versions/3.11.0b3/envs/3.11-beta-bottle/bin/python3
-- Server Python version: 3.11.0b3
-- Server has Clang support compiled in: True
-- Clang version: clang version 15.0.1 (https://github.com/tru/llvm-release-build 33b6cbead48e63164b3e7c5ac9d34505c0391552)
-- Extra configuration file found and loaded
-- Extra configuration path: /Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/default_ycm_extra_conf.py
-- C-family completer debug information:
--   Clangd running
--   Clangd process ID: 32037
--   Clangd executable: ['/usr/local/opt/llvm/bin/clangd', '-background-index', '-completion-style=bundled', '-pch-storage=memory', '

So the issue is you need to update ycmd to latest.

M4rtinK commented 2 years ago

So the issue is you need to update ycmd to latest. Yep, that worked - I've updated it but apparently too long ago. :) Thanks! :)