mason-org / mason-org/mason.nvim

Mason does not use the python provider on NixOS

Open
#1,817 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
10.5k
Forks
338
PR merge metrics
No merged PRs in 30d

Description

I've searched open issues for similar requests
  • Yes
I've recently downloaded the latest plugin version of mason.nvim
  • Yes
Problem description

I am experiencing the same issue as with #505 but with a different flavor likely cos of NixOs. Mason seems to expect a python binary in PATH even when a provider is given.

On NixOS one can install Neovim via program options and enable a python provider to be installed with it. Something like:

# Install and configure neovim
programs.neovim = {
  enable = true;
withPython = true;
};

Nix then installs Neovim and a python executable together and set that executable as the python provider:

provider.python: require("provider.python.health").check()

Python 3 provider (optional) ~
- Using: g:python3_host_prog = "/nix/store/<nix-sha1>-neovim-0.10.0/bin/nvim-python3"
- Executable: /nix/store/<nix-sha1>-neovim-0.10.0/bin/nvim-python3
- Python version: 3.11.9
- pynvim version: 0.5.0
- OK Latest pynvim is installed.

Python virtualenv ~
- OK no $VIRTUAL_ENV

However still, installation of packages which use the python or python3 binary fail with Unable to find python3 installation in PATH. Tried the following candidates: python3, python.

Perhaps I am misunderstanding and Mason only uses the PATH binaries, but the discussion in #505 points to the opposite.

Thanks.

Expected behavior

The python binary specified by the python provider is used to install mason packages.

Steps to reproduce
  1. Install neovim on NixOS
  2. Ensure that no system wide python installation exists
  3. Attempt to install a mason package with requires the python binary (e.g., ruff)
  4. Watch it fail with Unable to find python3 installation in PATH. Tried the following candidates: python3, python.
Neovim version (>= 0.7)

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202

Operating system/version

Linux 6.6.53 #1-NixOS SMP PREEMPT_DYNAMIC Mon Sep 30 14:25:15 UTC 2024 x86_64 GNU/Linux

Healthcheck output
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 `local: ~/Source/mason-registry` 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 built on linux-gnu.`
- OK curl: `curl 8.7.1 (x86_64-pc-linux-gnu) libcurl/8.7.1 OpenSSL/3.0.14 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.61.0`
- OK gzip: `gzip 1.13`
- OK tar: `tar (GNU tar) 1.35`
- OK bash: `GNU bash, version 5.2.32(1)-release (x86_64-pc-linux-gnu)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING Go: not available
  - ADVICE:
    - spawn: go failed with exit code - and signal -. go is not executable
- 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
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- OK cargo: `cargo 1.77.1`
- WARNING javac: not available
  - ADVICE:
    - spawn: javac failed with exit code - and signal -. javac is not executable
- WARNING java: not available
  - ADVICE:
    - spawn: java failed with exit code - and signal -. java is not executable
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- WARNING python: not available
  - ADVICE:
    - spawn: python3 failed with exit code - and signal -. python3 is not executable
- WARNING pip: not available
  - ADVICE:
    - spawn: python3 failed with exit code - and signal -. python3 is not executable
- WARNING python venv: not available
  - ADVICE:
    - On Debian/Ubuntu systems, you need to install the python3-venv package using the following command:
      
          apt-get install python3-venv
- OK Ruby: `ruby 3.1.6p260 (2024-05-29 revision a777087be6) [x86_64-linux]`
- OK node: `v22.4.1`
- OK RubyGem: `3.5.9`
- OK npm: `10.8.1`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Do 24 Okt 2024 12:42:46 CEST.
  Install and authenticate via gh-cli to increase rate limit.


### Screenshots

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the ruff installation failure on NixOS with the shown Neovim Python provider and no system-wide Python. Trace Mason's Python detection during package installation; done means packages requiring Python use the provider executable instead of only searching PATH.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, nixos, python
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.