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.59k stars 270 forks source link

[Docs] Clarify Debian/Ubuntu instructions for Python #729

Closed ashemedai closed 1 year ago

ashemedai commented 1 year ago

I've searched open issues for similar requests

Yes

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

Problem description

Various Python-dependent packages were failing to install, despite a :checkhealth mason showing that Python was fine.

Expected behavior

Either a clean installation or message showing a bit more why it failed to install.

Affected packages

black, clang-format, esbonio, isort

Mason output

N/A

Installation log

mason-core/installer/init.lua:154: Installation failed for Package(name=esbonio) error="...acker/start/mason.nvim/lua/mason-core/installer/init.lua:121: ...r/start/mason.nvim/lua/mason-core/managers/pip3/init.lua:78: Unable to create python3 venv environment."

Then I enabled debug logging, which didn't help much either:

...te/pack/packer/start/mason.nvim/lua/mason-core/spawn.lua:82: "python" is not executable
...acker/start/mason.nvim/lua/mason-core/installer/init.lua:154: Installation failed for Package(name=esbonio) error="...acker/start/mason.nvim/lua/mason-core/installer/init.lua:121: ...r/start/mason.nvim/lua/mason-core/managers/pip3/init.lua:90: Unable to create python3 venv environment."

Neovim version (>= 0.7)

NVIM v0.8.1 Build type: Release LuaJIT 2.1.0-beta3 Compiled by runner@fv-az178-366

Operating system/version

Linux wheeljack 5.15.74.2-microsoft-standard-WSL2 #1 SMP Wed Nov 2 19:50:29 UTC 2022 x86_64 GNU/Linux

Healthcheck

mason: require("mason.health").check()
========================================================================
## mason.nvim report
  - OK: neovim version >= 0.7.0
  - OK: Go: `go version go1.19.3 linux/amd64`
  - OK: cargo: `cargo 1.62.1 (a748cf5a3 2022-06-08)`
  - WARNING: luarocks: not available
  - OK: Ruby: `ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]`
  - OK: RubyGem: `3.2.5`
  - WARNING: Composer: not available
  - WARNING: PHP: not available
  - OK: npm: `8.16.0`
  - OK: node: `v16.16.0`
  - OK: python3: `Python 3.9.2`
  - OK: pip3: `pip 22.3.1 from /home/asmodai/.local/lib/python3.9/site-packages/pip (python 3.9)`
  - WARNING: javac: not available
  - WARNING: java: not available
  - WARNING: julia: not available
  - OK: wget: `GNU Wget 1.21 built on linux-gnu.`
  - OK: curl: `curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1n zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3`
  - OK: gzip: `gzip 1.10`
  - OK: tar: `tar (GNU tar) 1.34`
  - OK: bash: `GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)`
  - OK: sh: `Ok`
  - OK: GitHub API rate limit. Used: 2. Remaining: 58. Limit: 60. Reset: ma 05 dec 2022 12:32:12 CET.

Screenshots

No response

ashemedai commented 1 year ago

So I saw that debug log of "python" is not executable. Which makes sense, because Debian and Ubuntu (and quite a number of other OSes and/or distributions) only install python3 and no python with Python 3. And I thought this was the cause for the venv failing to be created.

So I figured, let's try a virtual env myself and ran python3 -m venv blah which reported back with:

The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt-get install python3-venv

After installing the python3-venv package, all the Mason stuff for Python-dependent packages started working.

So somewhere, it might make sense to highlight the need for this package on Debian/Ubuntu and derivatives.

redstreet commented 1 year ago

Thank you, @ashemedai, that helped save a lot of time (after I spent a lot of time with the issue first).

This is still an issue, perhaps a quick update to README.md to point to this issue for Debian/Ubuntu systems will help?

williamboman commented 1 year ago

This advice now shows up in :checkhealth mason https://github.com/williamboman/mason.nvim/pull/1358

redstreet commented 1 year ago

Perfect, thank you! And thanks for making and sharing Mason!

ashemedai commented 1 year ago

@williamboman Thanks, I am glad I didn't attempt a documentation PR, this is indeed a much more elegant solution. Silly me for not thinking of adding it to the checkhealth setup.