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

pylsp is missing a plugin and crashes on startup #1807

Open
3 tasks done
DreamyK9 opened this issue Oct 10, 2024 · 2 comments
Open
3 tasks done

pylsp is missing a plugin and crashes on startup #1807

DreamyK9 opened this issue Oct 10, 2024 · 2 comments

Comments

@DreamyK9
Copy link

DreamyK9 commented Oct 10, 2024

I've searched open issues for similar requests

  • Yes

I've manually reviewed logs to find potential errors

  • Yes

I've recently downloaded the latest plugin version of mason.nvim

  • Yes

Problem description

Problem

Most times when opening a python file and thereby loading pylsp, it crashes, trying to load a module named pylsp.plugins.rope_rename.
In some rare cases pylsp started fine, without any errors, though I couldn't figure out what caused it to occasionally work.

This issue also occured to others in the last few days, as can be seen in this Reddit thread.

Reason

The file .../mason/packages/python-lsp-server/venv/lib/python3.11/site-packages/pylsp/ is in fact missing inside the pylsp installation provided.
Reinstalling pylsp via mason didn't fix it.

Quickfix

Retrieving the file from this python-language-server repo (not sure if official) and manually adding it to the above directory fixed the problem for me and at least one other user from the Reddit thread.

Even after the quickfix, it still occasionally (seemingly randomly) crashes with ModuleNotFoundError: No module named 'pyls'.

Expected behavior

pylsp should start quietly and provide language features.

Steps to reproduce

  1. Install pylsp using mason
  2. Setup pylsp using nvim-lspconfig
  3. Open a python file

Affected packages

pylsp

Neovim version (>= 0.7)

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713484068

Operating system/version

Windows 10 Pro 22H2 - Build 19045.4894

Healthcheck

mason: require("mason.health").check()

mason.nvim
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
    mason.providers.registry-api
    mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-10-10-moldy-trust` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code - and signal -. wget is not executable
- OK curl: `curl 8.9.0 (x86_64-w64-mingw32) libcurl/8.9.0 Schannel zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0
`
- OK gzip: `gzip 1.13`
- OK tar: `tar (GNU tar) 1.35`
- ERROR pwsh: not available
  - ADVICE:
    - spawn: pwsh failed with exit code - and signal -. pwsh is not executable
- WARNING 7z: not available
  - ADVICE:
    - spawn: 7z failed with exit code - and signal -. 7z is not executable

mason.nvim [Languages] ~
- WARNING Go: not available
  - ADVICE:
    - spawn: go failed with exit code - and signal -. go is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Ruby: not available
  - ADVICE:
    - spawn: ruby failed with exit code - and signal -. ruby is not executable
- WARNING RubyGem: not available
  - ADVICE:
    - spawn: gem.cmd failed with exit code - and signal -. gem.cmd is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer.bat failed with exit code - and signal -. composer.bat is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- WARNING npm: not available
  - ADVICE:
    - spawn: npm.cmd failed with exit code - and signal -. npm.cmd is not executable
- WARNING node: not available
  - ADVICE:
    - spawn: node failed with exit code - and signal -. node is not executable
- WARNING javac: not available
  - ADVICE:
    - spawn: javac failed with exit code - and signal -. javac is not executable
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code 1 and signal 0. error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured.
      help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.
      
- OK python: `Python 3.12.4
`
- OK java: `java version "1.8.0_251"
`
- OK pip: `pip 24.2 from C:\Users\jwolf\AppData\Local\anaconda3\Lib\site-packages\pip (python 3.12)

`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 36. Remaining: 24. Limit: 60. Reset: 10.10.2024 15:54:54.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots or recordings

First error message:

rope_rename_not_found.log

rope_rename_not_found

Second error message (after quickfix):

pyls_not_found.log

pyls_not_found

@DreamyK9 DreamyK9 changed the title pylsp installation is missing a plugin pylsp installation is missing a plugin and crashes on startup Oct 10, 2024
@DreamyK9 DreamyK9 changed the title pylsp installation is missing a plugin and crashes on startup pylsp is missing a plugin and crashes on startup Oct 10, 2024
@CRThaze
Copy link

CRThaze commented Oct 11, 2024

I manged to silence the ModuleNotFoundError: No module named 'pyls' error by navigating to the venv and pip installing python-language-server[all] like so:

cd $HOME/.local/share/nvim/mason/packages/python-lsp-server/venv
bin/pip install --upgrade python-language-server[all]

I assume this also would have solved the missing rope_rename but I'm not sure (as I had followed the quick-fix suggested in the issue report already), possibly adding --force-reinstall would do it if not.

@DreamyK9
Copy link
Author

DreamyK9 commented Oct 11, 2024

@CRThaze Thanks! That fixed it for me.

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

No branches or pull requests

2 participants