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

feat(pypi): fallback to virtualenv if venv fails #1682

Open kbenzie opened 2 months ago

kbenzie commented 2 months ago

On Ubuntu 22.04 when the python3-venv package is not installed:

$ python3 -m venv $VENV_DIR
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 install python3.10-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: /root/venv/bin/python3

When running in a rootless environment installing the python3-venv package is not tenable. However, the virtualenv package can be installed via pip in the users home directory.

This patch checks the result of python3 -m venv $VENV_DIR, if that fails then it will fallback to calling python3 -m virtualenv $VENV_DIR instead.