williamboman / mason.nvim

Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters.
Apache License 2.0
7.22k stars 258 forks source link

[Docs] Python packages failing to install for Ubuntu (ensurepip is disabled in Debian/Ubuntu for the system python...) #1732

Open Xifong opened 3 weeks ago

Xifong commented 3 weeks ago

I've searched open issues for similar requests

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

Problem description

I'm unable to install any packages that Mason needs to create python venvs for. I believe Mason is providing the ensurepip flag to python when creating the venv which falls afoul of:

python -m ensurepip --upgrade --default-pip
ensurepip is disabled in Debian/Ubuntu for the system python.

Python modules For the system python are usually handled by dpkg and apt-get.

    apt-get install python-<module name>

Install the python-pip package to use pip itself.  Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.

This is similar to issue https://github.com/williamboman/mason.nvim/issues/729, but not the same because python3-venv is already installed and the following is successful:

python3 -m venv blah

I think it's the use of the ensurepip flag which is causing the problem.

Expected behavior

Packages install.

Affected packages

ruff-lsp, jedi-language-server

Mason output

Creating virtual environment…
        Error: Command '['/home/xifong/.local/share/nvim/mason/packages/jedi-language-server/venv/bin/python3.10', '-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
        spawn: python3.10 failed with exit code 1 and signal 0.

Installation log

[ERROR Tue 11 Jun 2024 15:03:54 BST] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=jedi-language-server) error=spawn: python3.10 failed with exit code 1 and signal 0. 

### Neovim version (>= 0.7)

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

### Operating system/version

Linux xifong-tm05462.lon.thomac.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

### Healthcheck

```Text
==============================================================================
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-06-11-elated-pants` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.`
- OK wget: `GNU Wget 1.21.2 built on linux-gnu.`
- OK curl: `curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.17`
- OK gzip: `gzip 1.10`
- OK tar: `tar (GNU tar) 1.34`
- OK bash: `GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- OK Go: `go version go1.22.4 linux/amd64`
- OK Ruby: `ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]`
- 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
- OK node: `v22.2.0`
- OK python: `Python 3.10.12`
- OK PHP: `PHP 8.1.2-1ubuntu2.17 (cli) (built: May  1 2024 10:10:07) (NTS)`
- OK npm: `10.7.0`
- OK RubyGem: `3.3.5`
- OK pip: `pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 8. Remaining: 52. Limit: 60. Reset: Tue 11 Jun 2024 15:28:09 BST.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots

No response

kuator commented 2 weeks ago

Hi, I had the same problem and decided to roll back a few commits:

return {
    "williamboman/mason.nvim",
    build = ":MasonUpdate", -- :MasonUpdate updates registry contents
    config = function()
      require("mason").setup()
    end,
    commit='0f1cb65f436b769733d18b41572f617a1fb41f62',
    lazy = true
}

The commit above works for me