mason.nvim icon indicating copy to clipboard operation
mason.nvim copied to clipboard

Mason chooses wrong python version.

Open dgdsingen opened this issue 1 year ago • 3 comments
trafficstars

I've searched open issues for similar requests

  • [x] Yes

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

  • [X] Yes

Problem description

When installing the nginx-language-server package, mason chooses wrong python version and the installation fails. Mason chooses the stock python version(3.11.3 installed with pyenv) initially, but then overwrites it with python3.12. [email protected] is installed successfully in Python 3.11, but failed in Python 3.12.

Expected behavior

1. Mason chooses the stock python version rather than versioned candidates.

  • Usually, versioned candidates, such as python3.12, are provided as symbolic links to python3, and users can choose between stock or versioned one by setting it at the order of $PATH.
  • Even if the user has fixed the stock python version with pyenv, if Mason chooses versioned one, it can be broken at any time by choosing the python version automatically updated by brew.

2. Then nginx-language-server package is installed successfully.

Affected packages

nginx-language-server

Mason output

Failed
    ◍ nginx-language-server
      ▼ Displaying full log
        Creating virtual environment…
        Installing pip package [email protected]…
        ERROR: Ignored the following versions that require a different python version: 0.8.0 Requires-Python >=3.8,<3.12
        ERROR: Could not find a version that satisfies the requirement nginx-language-server==0.8.0 (from versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.5.1, 0.6.0, 0.7.0, 0.7.1)
        ERROR: No matching distribution found for nginx-language-server==0.8.0
        spawn: /Users/choegeun/.local/share/nvim/mason/packages/nginx-language-server/venv/bin/python failed with exit code 1 and signal 0.

Installation log

[DEBUG 수  2/28 12:37:03 2024] ...ocal/share/nvim/lazy/mason.nvim/lua/mason-core/fetch.lua:37: Fetching URL "https://api.mason-registry.dev/api/github/mason-org/mason-registry/releases/latest"
[DEBUG 수  2/28 12:37:03 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "Accept: application/vnd.mason-registry.v1+json; q=1.0, application/json; q=0.8", "-H", "User-Agent: mason.nvim v1.10.0 (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "--connect-timeout", 30, "https://api.mason-registry.dev/api/github/mason-org/mason-registry/releases/latest" }
}
[DEBUG 수  2/28 12:37:03 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 56749
[DEBUG 수  2/28 12:37:04 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=56749 exited with exit_code=0, signal=0
[DEBUG 수  2/28 12:37:04 2024] ...ocal/share/nvim/lazy/mason.nvim/lua/mason-core/fetch.lua:37: Fetching URL "https://github.com/mason-org/mason-registry/releases/download/2024-02-28-prime-racing/registry.json.zip"
[DEBUG 수  2/28 12:37:04 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "User-Agent: mason.nvim v1.10.0 (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "-o", "/Users/choegeun/.local/share/nvim/mason/registries/github/mason-org/mason-registry/registry.json.zip", "--connect-timeout", 30, "https://github.com/mason-org/mason-registry/releases/download/2024-02-28-prime-racing/registry.json.zip" }
}
[DEBUG 수  2/28 12:37:04 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 56765
[DEBUG 수  2/28 12:37:04 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=56765 exited with exit_code=0, signal=0
[DEBUG 수  2/28 12:37:04 2024] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:59: fs: unlink /Users/choegeun/.local/share/nvim/mason/registries/github/mason-org/mason-registry/registry.json.zip
[DEBUG 수  2/28 12:37:04 2024] ...ocal/share/nvim/lazy/mason.nvim/lua/mason-core/fetch.lua:37: Fetching URL "https://github.com/mason-org/mason-registry/releases/download/2024-02-28-prime-racing/checksums.txt"
[DEBUG 수  2/28 12:37:04 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "User-Agent: mason.nvim v1.10.0 (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "--connect-timeout", 30, "https://github.com/mason-org/mason-registry/releases/download/2024-02-28-prime-racing/checksums.txt" }
}
[DEBUG 수  2/28 12:37:04 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 56781
[DEBUG 수  2/28 12:37:04 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=56781 exited with exit_code=0, signal=0
[INFO  수  2/28 12:37:07 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=nginx-language-server) {}
[DEBUG 수  2/28 12:37:07 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:58: Attempting to lock package Package(name=nginx-language-server)
[DEBUG 수  2/28 12:37:07 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:70: Wrote lockfile Package(name=nginx-language-server)
[DEBUG 수  2/28 12:37:07 2024] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:71: fs: mkdirp /Users/choegeun/.local/share/nvim/mason/staging/nginx-language-server
[DEBUG 수  2/28 12:37:07 2024] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:149: Compiling installer. nginx-language-server {}
[DEBUG 수  2/28 12:37:07 2024] ...zy/mason.nvim/lua/mason-core/installer/managers/pypi.lua:125: pypi: init
[DEBUG 수  2/28 12:37:07 2024] ...vim/lazy/mason.nvim/lua/mason-core/installer/context.lua:229: Promoting cwd "/Users/choegeun/.local/share/nvim/mason/staging/nginx-language-server" to "/Users/choegeun/.local/share/nvim/mason/packages/nginx-language-server"
[DEBUG 수  2/28 12:37:07 2024] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:65: fs: mkdir /Users/choegeun/.local/share/nvim/mason/packages/nginx-language-server
[DEBUG 수  2/28 12:37:07 2024] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:84: fs: rename /Users/choegeun/.local/share/nvim/mason/staging/nginx-language-server /Users/choegeun/.local/share/nvim/mason/packages/nginx-language-server
[DEBUG 수  2/28 12:37:07 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="python3", spawn_opts={
  args = { "--version" }
}
[DEBUG 수  2/28 12:37:07 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 56795
[DEBUG 수  2/28 12:37:07 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=56795 exited with exit_code=0, signal=0
[DEBUG 수  2/28 12:37:07 2024] ...zy/mason.nvim/lua/mason-core/installer/managers/pypi.lua:59: Resolved stock python3 installation version 3.11.3
[DEBUG 수  2/28 12:37:07 2024] ...zy/mason.nvim/lua/mason-core/installer/managers/pypi.lua:62: Resolving versioned python3 candidates { "python3.12" }
[DEBUG 수  2/28 12:37:07 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="python3.12", spawn_opts={
  args = { "--version" }
}
[DEBUG 수  2/28 12:37:07 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 56832
[DEBUG 수  2/28 12:37:07 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=56832 exited with exit_code=0, signal=0
[DEBUG 수  2/28 12:37:07 2024] ...zy/mason.nvim/lua/mason-core/installer/managers/pypi.lua:73: Found python3 installation version=3.12.2, executable="python3.12"
[DEBUG 수  2/28 12:37:07 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="python3.12", spawn_opts={
  args = { "-m", "venv", "venv" },
  cwd = "/Users/choegeun/.local/share/nvim/mason/packages/nginx-language-server"
}
[DEBUG 수  2/28 12:37:07 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 56844
[DEBUG 수  2/28 12:37:09 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=56844 exited with exit_code=0, signal=0
[DEBUG 수  2/28 12:37:09 2024] ...zy/mason.nvim/lua/mason-core/installer/managers/pypi.lua:145: pypi: install "nginx-language-server" "0.8.0"
[DEBUG 수  2/28 12:37:09 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="/Users/choegeun/.local/share/nvim/mason/packages/nginx-language-server/venv/bin/python", spawn_opts={
  args = { "-m", "pip", "--disable-pip-version-check", "install", "-U", "nginx-language-server==0.8.0" },
  cwd = "/Users/choegeun/.local/share/nvim/mason/packages/nginx-language-server"
}
[DEBUG 수  2/28 12:37:09 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 56854
[DEBUG 수  2/28 12:37:10 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=56854 exited with exit_code=1, signal=0
[DEBUG 수  2/28 12:37:10 2024] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:59: fs: unlink /Users/choegeun/.local/share/nvim/mason/staging/nginx-language-server.lock
[DEBUG 수  2/28 12:37:10 2024] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:47: fs: rmrf /Users/choegeun/.local/share/nvim/mason/packages/nginx-language-server
[DEBUG 수  2/28 12:37:10 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:39: Building receipt for Package(name=nginx-language-server)
[ERROR 수  2/28 12:37:10 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=nginx-language-server) error=spawn: /Users/choegeun/.local/share/nvim/mason/packages/nginx-language-server/venv/bin/python failed with exit code 1 and signal 0.

Neovim version (>= 0.7)

NVIM v0.9.5 Build type: Release LuaJIT 2.1.1703358377

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Run :checkhealth for more info

Operating system/version

Darwin MacBook-Pro-3.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:21:53 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6020 arm64

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-02-27-third-orchid` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- OK wget: `GNU Wget 1.21.4. darwin22.4.0에 빌드함.`
- OK curl: `curl 8.1.2 (x86_64-apple-darwin22.0) libcurl/8.1.2 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.51.0`
- OK gzip: `Ok`
- OK tar: `bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
- OK bash: `GNU bash, 버전 5.2.26(1)-release (aarch64-apple-darwin22.6.0)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- OK Ruby: `ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin22]`
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- OK Go: `go version go1.22.0 darwin/arm64`
- OK luarocks: `/opt/homebrew/bin/luarocks 3.9.2`
- OK RubyGem: `3.0.3.1`
- OK java: `openjdk version "1.8.0_372"`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK cargo: `cargo 1.74.0 (ecb9851af 2023-10-18)`
- WARNING JAVA_HOME: not available
  - ADVICE:
    - spawn: /Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home/bin/java failed with exit code - and signal -. /Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home/bin/java is not executable
- OK javac: `Ok`
- OK node: `v21.6.2`
- OK python: `Python 3.11.3`
- OK npm: `10.2.4`
- OK pip: `pip 24.0 from /Users/choegeun/.pyenv/versions/3.11.3/lib/python3.11/site-packages/pip (python 3.11)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 5000. Limit: 5000. Reset: 수  2/28 11:41:05 2024.

Screenshots

image

dgdsingen avatar Feb 28 '24 05:02 dgdsingen

+1 seeing this issue when installing pylsp

jswalton avatar Mar 14 '24 18:03 jswalton

  • 1 when installing nginx-language-server. Patching #1639 solves it for me

chardskarth avatar Mar 16 '24 14:03 chardskarth

The PR does indeed fix the issue. I temporarily edited the change into ~/.local/share/nvim/lazy/mason.nvim/lua/mason-core/installer/managers/pypi.lua (similar with other plugin managers than lazy) Let Mason run the installations and then changed it back so there won't be issues with updates.

AtomToast avatar Apr 03 '24 15:04 AtomToast

This issue is resolved by #1725

dgdsingen avatar Jun 02 '24 01:06 dgdsingen