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.69k stars 271 forks source link

add windows python install candidate #1621

Closed Redhawk18 closed 1 month ago

Redhawk18 commented 8 months ago

I've searched open issues for similar requests

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

Problem description

On windows python's default path value is py, Currently I'm trying to create a symlink but it's harder than you would think.

Expected behavior

to check py as a candidate.

Affected packages

black, pydocstring

Mason output

Failed
    ✗ black
      ▼ Displaying full log
        Unable to find python3 installation. Tried the following candidates: python, python3, python3.12, python3.11, python3.10, python3.9, python3.8, python3.7, python3.6.
        Failed to find python3 installation.

Installation log

[INFO  2/5/2024 12:16:09 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=bash-language-server) {}
[INFO  2/5/2024 12:16:09 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=bash-debug-adapter) {}
[INFO  2/5/2024 12:16:09 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=shfmt) {}
[INFO  2/5/2024 12:16:10 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=clangd) {}
[INFO  2/5/2024 12:16:15 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=css-lsp) {}
[INFO  2/5/2024 12:16:15 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=shfmt)
[INFO  2/5/2024 12:16:17 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=html-lsp) {}
[INFO  2/5/2024 12:16:17 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=bash-debug-adapter)
[INFO  2/5/2024 12:16:21 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=lua-language-server) {}
[INFO  2/5/2024 12:16:21 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=clangd)
[INFO  2/5/2024 12:16:31 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=pyright) {}
[INFO  2/5/2024 12:16:31 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=lua-language-server)
[INFO  2/5/2024 12:16:33 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=pydocstyle) {}
[INFO  2/5/2024 12:16:33 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=bash-language-server)
[INFO  2/5/2024 12:16:34 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=black) {}
[ERROR 2/5/2024 12:16:34 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=pydocstyle) error="Failed to find python3 installation."
[INFO  2/5/2024 12:16:35 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=rust-analyzer) {}
[ERROR 2/5/2024 12:16:35 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=black) error="Failed to find python3 installation."
[INFO  2/5/2024 12:16:40 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=codelldb) {}
[INFO  2/5/2024 12:16:40 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=rust-analyzer)
[INFO  2/5/2024 12:16:43 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=css-lsp)
[INFO  2/5/2024 12:16:43 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=html-lsp)
[INFO  2/5/2024 12:16:54 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=codelldb)
[INFO  2/5/2024 12:16:57 PM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=pyright)

Neovim version (>= 0.7)

NVIM v0.9.5 Build type: RelWithDebInfo LuaJIT 2.1.1703942320 Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe /MD /Zi /O2 /Ob1 -W3 -wd4311 -wd4146 -DUNIT_TESTING -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602 -DMSWIN -DINCLUDE_GENERATED_DECLARATIONS -ID:/a/neovim/neovim/.deps/usr/include/luajit-2.1 -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/build/src/nvim/auto -ID:/a/neovim/neovim/build/include -ID:/a/neovim/neovim/build/cmake.config -ID:/a/neovim/neovim/src -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include

system vimrc file: "$VIM\sysinit.vim" fall-back for $VIM: "C:/Program Files (x86)/nvim/share/nvim"

Operating system/version

windows 10

Healthcheck

==============================================================================
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-02-05-senior-wasp` is installed.

mason.nvim [Core utils] ~
- WARNING unzip: not available
  - ADVICE:
    - spawn: unzip failed with exit code - and signal -. unzip is not executable
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code - and signal -. wget is not executable
- OK curl: `curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
`
- WARNING gzip: not available
  - ADVICE:
    - spawn: gzip failed with exit code - and signal -. gzip is not executable
- OK tar: `bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f-ipp
`
- ERROR pwsh: not available
  - ADVICE:
    - spawn: pwsh failed with exit code - and signal -. pwsh is not executable
- WARNING 7z: not available
  - ADVICE:
    - spawn: 7z failed with exit code - and signal -. 7z is not executable

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 julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- WARNING python: not available
  - ADVICE:
    - spawn: python failed with exit code - and signal -. python is not executable
- WARNING pip: not available
  - ADVICE:
    - spawn: python failed with exit code - and signal -. python is not executable
- WARNING python venv: not available
  - ADVICE:
    - On Debian/Ubuntu systems, you need to install the python3-venv package using the following command:

      apt-get install python3-venv
- OK node: `v21.6.1
`
- OK java: `java version "1.8.0_131"
`
- OK npm: `10.2.4`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: 2/5/2024 1:29:19 PM.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots

No response

stevenctl commented 3 months ago

@Redhawk18 looks like you have a fix for this in your fork. Do you plan on upstreaming that?

Redhawk18 commented 3 months ago

@Redhawk18 looks like you have a fix for this in your fork. Do you plan on upstreaming that?

Sure, bit I don't have merge rights the pr is open. Since it's been so long it now conflicts with what I originally wrote.

stevenctl commented 3 months ago

FWIW I just got things working by switching from the Microsoft Store installation, to using the installer from python.org (no patches to Mason)

Redhawk18 commented 3 months ago

I don't use that computer anymore so its not an issue.

ItachiSan commented 2 months ago

I also have this same issue. What can I do for helping?

BurnerWah commented 1 month ago

The windows store python related problems are a bug from vim - https://github.com/vim/vim/commit/40fd7e665260c9227d6d90b17a301a1bc47f7f5b Mason is checking via vim.fn.executable() if a command is in the path, which fails to detect the app executaion aliases that the windows store version of python produces.

As a very stupid hack to work around that until the fix gets into neovim, you can just make a scoop shim to the execution alias, or probably even make a script to just execute the execution alias.

This also works for the store version of Julia, and with NanaZip.