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

How to handle "ModuleNotFoundError: No module named 'pylsp.plugins.rope_rename'" #588

Open
buhtz opened this issue Aug 11, 2024 · 7 comments

Comments

@buhtz
Copy link

buhtz commented Aug 11, 2024

Hello,

I was updating all my Emacs (29 from Debian 12 backports) packages after a while and no got this error. After doing some research it seems that rope-support was removed from pylsp.

[eglot] (warning) [eglot] -32602: ModuleNotFoundError: No module named 'pylsp.plugins.rope_rename'

I installed it explicit via pip install -U pylsp-rope but nothing changed.
OK, I am also fine with just disabling rope in my setup. But I don't know how. I don't see "rope" in my init.el.

My (reduced) init.el is ~240 lines long. Not sure if it make sense to post it here.

Any suggestion how to go further with analyzing this?

@ghost-in-the-zsh
Copy link

ghost-in-the-zsh commented Aug 28, 2024

I encountered this pylsp crash after a recent nvim "!Lazy sync" ... command, even after updating everything else. The LSP stacktrace I got is below, pretty-fied and with my home path replaced by $HOME. This is a hard crash that prevents the LSP from launching and attaching to the buffer. Are there any suggested workarounds while a fix is released? 🤔

Error executing vim.schedule lua callback: .../nvim/2823/usr/share/nvim/runtime/lua/vim/lsp/client.lua:589: RPC[Error] code_name = InvalidParams, message = "ModuleNotFoundError: No module named 'pylsp.plugins.rope_rename'" data = {
  traceback = {
    "  File \"$HOME/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.12/site-packages/pylsp_jsonrpc/endpoint.py\", line 117, in consume\n   self._handle_request(message['id'], message['method'], message.get('params'))\n",
    '  File "$HOME/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.12/site-packages/pylsp_jsonrpc/endpoint.py", line 197, in _handle_request\n    handler_result = handler(params)\n  ^^^^^^^^^^^^^^^\n',
    '  File "$HOME/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.12/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler\n    return method(**(params or {}))\n           ^^^^^^^^^^^^^^^^^^^^^^^^\n',
    '  File "$HOME/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.12/site-packages/pylsp/python_lsp.py", line 326, in m_initialize\n    self.config = config.Config(\n                  ^^^^^^^^^^^^^^\n',
    '  File "$HOME/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.12/site-packages/pylsp/config/config.py", line 89, in __init__\n    self._pm.load_setuptools_entrypoints(PYLSP)\n',
    '  File "$HOME/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints\n    plugin = ep.load()\n             ^^^^^^^^^\n',
    "  File \"$HOME/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.12/site-packages/importlib_metadata/__init__.py\", line 183, in load\n    module = import_module(match.group('module'))\n         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
    '  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module\n    return _bootstrap._gcd_import(name[level:], package, level)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n',
    '  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import\n',
    '  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load\n',
    '  File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked\n'
  }
}
stack traceback:
        [C]: in function 'assert'
        .../nvim/2823/usr/share/nvim/runtime/lua/vim/lsp/client.lua:589: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

@php1ic
Copy link

php1ic commented Aug 29, 2024

I'm having the same issue with neovim after a recent update of packages and lsp servers on my system. Could this be related to #515?

@dcherian
Copy link

dcherian commented Aug 30, 2024

Here is a traceback that might help

[stderr]  2024-08-30 09:37:12,221 MDT - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 1
[stderr]  Traceback (most recent call last):
[stderr]    File "/Users/deepak/miniforge3/lib/python3.11/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
[stderr]      self._handle_request(message['id'], message['method'], message.get('params'))
[stderr]    File "/Users/deepak/miniforge3/lib/python3.11/site-packages/pylsp_jsonrpc/endpoint.py", line 197, in _handle_request
[stderr]      handler_result = handler(params)
[stderr]                       ^^^^^^^^^^^^^^^
[stderr]    File "/Users/deepak/miniforge3/lib/python3.11/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
[stderr]      return method(**(params or {}))
[stderr]             ^^^^^^^^^^^^^^^^^^^^^^^^
[stderr]    File "/Users/deepak/miniforge3/lib/python3.11/site-packages/pylsp/python_lsp.py", line 326, in m_initialize
[stderr]      self.config = config.Config(
[stderr]                    ^^^^^^^^^^^^^^
[stderr]    File "/Users/deepak/miniforge3/lib/python3.11/site-packages/pylsp/config/config.py", line 89, in __init__
[stderr]      self._pm.load_setuptools_entrypoints(PYLSP)
[stderr]    File "/Users/deepak/miniforge3/lib/python3.11/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
[stderr]      plugin = ep.load()
[stderr]               ^^^^^^^^^
[stderr]    File "/Users/deepak/miniforge3/lib/python3.11/site-packages/importlib_metadata/__init__.py", line 183, in load
[stderr]      module = import_module(match.group('module'))
[stderr]               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stderr]    File "/Users/deepak/miniforge3/lib/python3.11/importlib/__init__.py", line 126, in import_module
[stderr]      return _bootstrap._gcd_import(name[level:], package, level)
[stderr]             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stderr]    File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
[stderr]    File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
[stderr]    File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
[stderr]  ModuleNotFoundError: No module named 'pylsp.plugins.rope_rename'

magically, just adding an empty rope_rename.py in plugins/ makes it all work

@php1ic
Copy link

php1ic commented Sep 1, 2024

Adding the file works for me. Thanks @dcherian!

@ghost-in-the-zsh
Copy link

The issue seems to have been resolved. I updated yesterday, without manually adding any files, and I no longer see the error.

@php1ic
Copy link

php1ic commented Sep 1, 2024

Strange, I still see the error if I remove the rope_rename.py file.

What did you update? I've got all the latest updates for packages installed via Lazy and I use Mason for my LSP servers and that is still showing 1.12.0 for python-lsp-server with no available updates.

@ghost-in-the-zsh
Copy link

ghost-in-the-zsh commented Sep 2, 2024

Strange, I still see the error if I remove the rope_rename.py file.

What did you update? I've got all the latest updates for packages installed via Lazy and I use Mason for my LSP servers and that is still showing 1.12.0 for python-lsp-server with no available updates.

I stand corrected... after updating this morning, I now see the crash again, but it was definitely not broken when I posted last time. Someone seems to keep messing up and there's no official response in this thread, either...

BTW, if anyone's wondering where, exactly, you should touch rope_rename.py, it should be under $HOME/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/<your-python-version>/site-packages/pylsp/plugins/

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

No branches or pull requests

4 participants