Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mason.nvim doesn't see my python that was installed with pyenv-win #1753

Open
2 tasks done
jckli opened this issue Jul 11, 2024 · 6 comments
Open
2 tasks done

mason.nvim doesn't see my python that was installed with pyenv-win #1753

jckli opened this issue Jul 11, 2024 · 6 comments

Comments

@jckli
Copy link

jckli commented Jul 11, 2024

I've searched open issues for similar requests

  • Yes

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

  • Yes

Problem description

:checkhealth mason reports that it can't find any python.

I installed python 3.11.9 with pyenv-win that was installed with chocolatey and set it as my global so python and pip both run and display as 3.11.9. My windows path also says that the pythons are added to path, however mason.nvim still can't see the python and thus can't install any python packages.

Expected behavior

Python detected as installed on my windows machine and packages install successfully.

Affected packages

All python 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: press <C-f> to apply filter

  Failed
    ◍ black
      ▶ # [2/2] Unable to find python3 installation in PATH. Tried the following candidates: python, python3.

  Installed
    ◍ clangd
    ◍ css-lsp cssls
    ◍ gopls
    ◍ html-lsp html
    ◍ json-lsp jsonls
    ◍ lua-language-server lua_ls
    ◍ marksman
    ◍ pyright
    ◍ rust-analyzer rust_analyzer
    ◍ tailwindcss-language-server tailwindcss
    ◍ typescript-language-server tsserver

  Available
    ◍ actionlint
    ◍ ada-language-server als
    ◍ aiken
    ◍ alex
    ◍ angular-language-server angularls

Installation log

[INFO  7/11/2024 12:04:09 AM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=black) {}
[ERROR 7/11/2024 12:04:09 AM] ...cal/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:152: Failed to spawn process. cmd="python", err="ENOENT: no such file or directory"
[ERROR 7/11/2024 12:04:09 AM] ...cal/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:152: Failed to spawn process. cmd="python3", err="ENOENT: no such file or directory"
[ERROR 7/11/2024 12:04:09 AM] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=black) error="Unable to find python3 installation in PATH. Tried the following candidates: python, python3."

Neovim version (>= 0.7)

NVIM v0.11.0-dev-387+g158ffd646
Build type: RelWithDebInfo
LuaJIT 2.1.1720049189

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-07-11-uppity-dolphin` 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 8.7.1 (Windows) libcurl/8.7.1 Schannel zlib/1.3 WinIDN
`
- WARNING gzip: not available
  - ADVICE:
    - spawn: gzip failed with exit code - and signal -. gzip is not executable
- OK tar: `bsdtar 3.5.2 - libarchive 3.5.2 zlib/1.2.5.f-ipp 
`
- ERROR pwsh: not available
  - ADVICE:
    - spawn: pwsh failed with exit code - and signal -. pwsh is not executable
- OK 7z: `7-Zip 24.07 (x64) : Copyright (c) 1999-2024 Igor Pavlov : 2024-06-19
`

mason.nvim [Languages] ~
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo 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 luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. Could not find executable "luarocks" in path.
      
- WARNING Ruby: not available
  - ADVICE:
    - spawn: ruby failed with exit code - and signal -. ruby is not executable
- WARNING javac: not available
  - ADVICE:
    - spawn: javac failed with exit code - and signal -. javac is not executable
- WARNING RubyGem: not available
  - ADVICE:
    - spawn: gem.cmd failed with exit code - and signal -. gem.cmd 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 -. Could not find executable "python" in path.
      
- WARNING pip: not available
  - ADVICE:
    - spawn: python failed with exit code - and signal -. Could not find executable "python" in path.
      
- 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: `v20.15.1
`
- OK Go: `go version go1.22.5 windows/amd64`
- OK java: `openjdk version "21.0.3" 2024-04-16 LTS
`
- OK JAVA_HOME: `openjdk version "17.0.11" 2024-04-16
`
- OK npm: `10.7.0`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: 7/11/2024 1:05:51 AM.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots

This is my output when running pyenv and python commands:
image

@msberk
Copy link

msberk commented Aug 6, 2024

Can confirm that I am facing the same issue. Mason does not play nice with pyenv-win at all.

@BPplays
Copy link

BPplays commented Aug 8, 2024

this is also happening to me, hope this gets fixed for all the based pyenv-winpilled users out there

@wsbhacker
Copy link

this is also happening to me

@greasycat
Copy link

After spending some time testing stuff out, it seems that vim.loop.spawn is not recognizing the python.bat as python (provided by pyenv-win located in C:\Users\$username\.pyenv\pyenv-win\shims).

Spawn breaks without running the callback, so if you call :lua vim.uv.spawn("python", {}, function(exit_code, signal) print(exit_code) end). Nothing will be outputted

Here's my naive workaround.
insert "python.bat" and "python3.bat" to this line

local stock_candidates = platform.is.win and { "python", "python3" } or { "python3", "python" }

local stock_candidates = platform.is.win and { "python", "python3", "python3.bat", "python.bat" } or { "python3", "python" }

@tanishqmanuja
Copy link

Thanks @greasycat that works 🫡

@julien-h
Copy link

I am also having this exact same issue. I am using LazyVim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs triage
Development

No branches or pull requests

7 participants