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.86k stars 277 forks source link

wrong virtualenv python location in MSYS2 environment #1544

Closed juilpark closed 12 months ago

juilpark commented 1 year ago

I've searched open issues for similar requests

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

Problem description

In Windows MSYS2(UCRT64) with python virtualenv package(mingw-w64-ucrt-x86_64-python-virtualenv)

venv directory is different between Official Windows Python

In Windows MSYS2

❯ python -m venv venv
❯ ls -al venv
합계 9
drwxr-xr-x 1 ju475 ju475   0 11월  1 12:35 .
drwxr-xr-x 1 ju475 ju475   0 11월  1 12:35 ..
drwxr-xr-x 1 ju475 ju475   0 11월  1 12:35 bin
drwxr-xr-x 1 ju475 ju475   0 11월  1 12:35 include
drwxr-xr-x 1 ju475 ju475   0 11월  1 12:35 lib
-rw-r--r-- 1 ju475 ju475 244 11월  1 12:35 pyvenv.cfg
❯ ls -al venv/bin
합계 1024
drwxr-xr-x 1 ju475 ju475      0 11월  1 12:35 .
drwxr-xr-x 1 ju475 ju475      0 11월  1 12:35 ..
-rw-r--r-- 1 ju475 ju475   2012 11월  1 12:35 activate
-rw-r--r-- 1 ju475 ju475   9033 11월  1 12:35 Activate.ps1
-rwxr-xr-x 1 ju475 ju475 108408 11월  1 12:35 pip.exe
-rwxr-xr-x 1 ju475 ju475 108408 11월  1 12:35 pip3.11.exe
-rwxr-xr-x 1 ju475 ju475 108408 11월  1 12:35 pip3.exe
-rwxr-xr-x 1 ju475 ju475 137766 11월  1 12:35 python.exe
-rwxr-xr-x 1 ju475 ju475 137766 11월  1 12:35 python3.11.exe
-rwxr-xr-x 1 ju475 ju475 137766 11월  1 12:35 python3.exe
-rwxr-xr-x 1 ju475 ju475 136973 11월  1 12:35 python3w.exe
-rwxr-xr-x 1 ju475 ju475 136973 11월  1 12:35 pythonw.exe

In Official Windows Python

PS C:\Users\ju475> python -m venv venv
PS C:\Users\ju475> dir venv

    디렉터리: C:\Users\ju475\venv

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----      2023-11-01  오후 12:36                Include
d-----      2023-11-01  오후 12:36                Lib
d-----      2023-11-01  오후 12:37                Scripts
-a----      2023-11-01  오후 12:36            220 pyvenv.cfg

PS C:\Users\ju475> dir .\venv\Scripts\

    디렉터리: C:\Users\ju475\venv\Scripts

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----      2023-11-01  오후 12:37           2059 activate
-a----      2023-11-01  오후 12:37            988 activate.bat
-a----      2023-11-01  오후 12:37          26199 Activate.ps1
-a----      2023-11-01  오후 12:37            393 deactivate.bat
-a----      2023-11-01  오후 12:37         108397 pip.exe
-a----      2023-11-01  오후 12:37         108397 pip3.11.exe
-a----      2023-11-01  오후 12:37         108397 pip3.exe
-a----      2023-11-01  오후 12:36         270608 python.exe
-a----      2023-11-01  오후 12:36         259352 pythonw.exe

Expected behavior

Install Ruff Successfully

Affected packages

all python related packages

Mason output

mason.nvim
                                                                                     press g? for help
                                                                        https://github.com/williamboman/mason.nvim
                     (1) All   (2) LSP   (3) DAP   (4) Linter   (5) Formatter

                    Language Filter: Python press <Esc> to clear

                    Failed (1)
                      ✗ pylint
                        ▼ Displaying full log
                          Creating virtual environment…
                          Installing pip package pylint@3.0.2…
                          spawn: C:\Users\ju475\AppData\Local\nvim-data\mason\packages\pylint\venv\Scripts\python.exe failed with exit code - and signal -. C:
                          \Users\ju475\AppData\Local\nvim-data\mason\packages\pylint\venv\Scripts\python.exe is not executable

                    Installed (0)
                                                                                       No packages.

                    Available (13)
                      ✗ flake8
                      ✗ mypy
                      ✗ pydocstyle
                      ✗ pyflakes
                      ✗ pylama
                      ✗ pyproject-flake8
                      ✗ pyre
                      ✗ rstcheck
                      ✗ ruff
                      ✗ semgrep
                      ✗ sonarlint-language-server
                      ✗ trivy
                      ✗ vulture

Installation log

[INFO  2023-11-01 오후 12:18:41] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=ruff) {}
[ERROR 2023-11-01 오후 12:18:46] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=ruff) error=spawn: C:\Users\ju475\AppData\Local\nvim-data\mason\packages\ruff\venv\Scripts\python.exe failed with exit code - and signal -. C:\Users\ju475\AppData\Local\nvim-data\mason\packages\ruff\venv\Scripts\python.exe is not executable
[INFO  2023-11-01 □□□□ 12:39:01] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=pylint) {}
[ERROR 2023-11-01 □□□□ 12:39:06] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=pylint) error=spawn: C:\Users\ju475\AppData\Local\nvim-data\mason\packages\pylint\venv\Scripts\python.exe failed with exit code - and signal -. C:\Users\ju475\AppData\Local\nvim-data\mason\packages\pylint\venv\Scripts\python.exe is not executable

Neovim version (>= 0.7)

❯ nvim --version NVIM v0.9.4 Build type: Release LuaJIT 2.1.1697887905

❯ python --version Python 3.11.6

Operating system/version

MINGW64_NT-10.0-22621 HOME-PC 3.4.9.x86_64 2023-09-15 12:15 UTC x86_64 Msys

Healthcheck

mason: require("mason.health").check()
                                                                                                                                                                                                                   mason.nvim
  - OK mason.nvim version v1.8.2                                                                                                                                                                                   - 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: 2023-10-31-amused-suede 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. cygwin에 빌드함.                                                                                                                                                                     - OK curl: curl 8.4.0 (x86_64-pc-cygwin) libcurl/8.4.0 OpenSSL/3.1.4 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.11.0 nghttp2/1.57.0                                 - OK gzip: gzip 1.13                                                                                                                                                                                             - OK tar: tar (GNU tar) 1.35                                                                                                                                                                                     - ERROR pwsh: not available                                                                                                                                                                                        - ADVICE:                                                                                                                                                                                                          - spawn: pwsh failed with exit code - and signal -. pwsh is not executable                                                                                                                                   - OK 7z: 7-Zip 23.01 (x64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20^M                                                                                                                                                                                                                                                                                                                                                   mason.nvim [Languages]                                                                                                                                                                                           - WARNING Go: not available                                                                                                                                                                                        - ADVICE:                                                                                                                                                                                                          - spawn: go failed with exit code - and signal -. go is not executable                                                                                                                                       - 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 Ruby: not available                                                                                                                                                                                      - ADVICE:                                                                                                                                                                                                          - spawn: ruby failed with exit code - and signal -. ruby is not executable
  - WARNING RubyGem: not available
    - ADVICE:
      - spawn: gem.cmd failed with exit code - and signal -. gem.cmd is not executable
  - WARNING Composer: not available
    - ADVICE:
      - spawn: composer.bat failed with exit code - and signal -. composer.bat is not executable
  - WARNING PHP: not available
    - ADVICE:
      - spawn: php failed with exit code - and signal -. php is not executable
  - 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 python: Python 3.11.6^M
  - OK node: v18.17.1^M
  - OK python3_host_prog: Python 3.11.6^M
  - OK pip: pip 23.2.1 from C:/Software/msys64/ucrt64/lib/python3.11/site-packages/pip (python 3.11)^M^M
  - OK python3_host_prog pip: pip 23.2.1 from C:/Software/msys64/ucrt64/lib/python3.11/site-packages/pip (python 3.11)^M^M
  - OK python venv: Ok
  - OK npm: 9.6.7

  mason.nvim [GitHub]
  - OK GitHub API rate limit. Used: 1. Remaining: 59. Limit: 60. Reset: 2023-11-01 오후 1:40:20.
    Install and authenticate via gh-cli to increase rate limit.

Screenshots

스크린샷 2023-11-01 124527 스크린샷 2023-11-01 124642 스크린샷 2023-11-01 124710

williamboman commented 1 year ago

Hey! Could you try the branch fix/python-msys2 (#1547) and see if it resolves this? I'm unable to set up an MSYS2 environment so I'm unable to test it end to end.

juilpark commented 1 year ago

I got link issue after pip works done 스크린샷 2023-11-03 003822

now python in Mason works, but link still finds Scripts directory

williamboman commented 1 year ago

Ah, could you try pulling the latest version of that branch and try again?

juilpark commented 1 year ago

Sorry for late reply, I pulled again and now it works perfectly! image

Thank you for your support :)))