Ubable to install pylsp

I tried to install pylsp using mason, but when I try to do that mason gives me this error message:

Installation failed for Package(name=python-lsp-server) error="Failed to create python3 virtual environment."

I tried to reinstall the virtual environment python packages but it didn’t solve it. I also tried to manually create a python virtual environment and it worked, so I don’t know why mason is not working.
If someone has an idea how to approach this problem, I’d really appreciate it…

Mason created its own virtual env when installing pip packages.

If you launch neovim when you are already inside a virtualenv, mason (which runs a sub process of neovim) is also trapped inside that env and cannot create its own.

In order to make mason work correctly, you have to launch neovim where the command pip points to the system pip or global python if using pyenv (and is not overwritten by some activated environment).

Not sure about conda cuz I don’t use it.

When you make this mistake, you cannot fix it by a simple update in mason’s UI but you first need to delete / uninstall the current one and start all over.