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

Re: 'Unable to find a valid git executable' when running 'poetry new' command on Windows 11 #8773

Closed
3 tasks done
brycepg opened this issue Dec 9, 2023 · 2 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected status/duplicate Duplicate issues

Comments

@brycepg
Copy link

brycepg commented Dec 9, 2023

  • Poetry version: 1.8.0.dev0
  • Python version :3.10.10
  • OS version and name: Windows 11
  • pyproject.toml: none
  • I am on the latest stable Poetry version, installed using a recommended method.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

This issue I believe is incorrectly closed since I'm encountering it on 1.8.0dev.

occurs with both cmd and pwsh

> %WINDIR%\System32\where.exe git
C:\Users\Bryce\scoop\shims\git.exe

poetry refuses to create a project in my home directory on Windows. In a subdirectory it works fine.
My git is installed via a shim from the scoop package manager
User benjis has suggested a fix: #5723 (comment)

Unable to find a valid git executable
(base) PS C:\Users\Bryce> ~\.local\bin\[email protected] -vvvv new fdds


  Stack trace:

  9  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\application.py:327 in run
      325│
      326│             try:
    → 327│                 exit_code = self._run(io)
      328│             except BrokenPipeError:
      329│                 # If we are piped to another process, it may close early and send a

  8  .local\pipx\venvs\poetry@git\lib\site-packages\poetry\console\application.py:190 in _run
      188│         self._load_plugins(io)
      189│
    → 190│         exit_code: int = super()._run(io)
      191│         return exit_code
      192│

  7  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\application.py:431 in _run
      429│             io.input.interactive(interactive)
      430│
    → 431│         exit_code = self._run_command(command, io)
      432│         self._running_command = None
      433│

  6  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\application.py:473 in _run_command
      471│
      472│         if error is not None:
    → 473│             raise error
      474│
      475│         return terminate_event.exit_code

  5  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\application.py:457 in _run_command
      455│
      456│             if command_event.command_should_run():
    → 457│                 exit_code = command.run(io)
      458│             else:
      459│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  4  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\commands\base_command.py:117 in run
      115│         io.input.validate()
      116│
    → 117│         return self.execute(io) or 0
      118│
      119│     def merge_application_definition(self, merge_args: bool = True) -> None:

  3  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\commands\command.py:61 in execute
       59│
       60│         try:
    →  61│             return self.handle()
       62│         except KeyboardInterrupt:
       63│             return 1

  2  .local\pipx\venvs\poetry@git\lib\site-packages\poetry\console\commands\new.py:62 in handle
       60│         readme_format = self.option("readme") or "md"
       61│
    →  62│         config = GitConfig()
       63│         author = None
       64│         if config.get("user.name"):

  1  .local\pipx\venvs\poetry@git\lib\site-packages\poetry\core\vcs\git.py:199 in __init__
      197│         try:
      198│             config_list = subprocess.check_output(
    → 199│                 [executable(), "config", "-l"], stderr=subprocess.STDOUT
      200│             ).decode()
      201│

  RuntimeError

  Unable to find a valid git executable

  at .local\pipx\venvs\poetry@git\lib\site-packages\poetry\core\vcs\git.py:182 in executable
      178│     else:
      179│         _executable = "git"
      180│
      181│     if _executable is None:
    → 182│         raise RuntimeError("Unable to find a valid git executable")
      183│
      184│     return _executable
      185│
      186│
(base) PS C:\Users\Bryce> ~\.local\bin\[email protected] -vvv new fdds

  Stack trace:

  9  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\application.py:327 in run
      325│
      326│             try:
    → 327│                 exit_code = self._run(io)
      328│             except BrokenPipeError:
      329│                 # If we are piped to another process, it may close early and send a

  8  .local\pipx\venvs\poetry@git\lib\site-packages\poetry\console\application.py:190 in _run
      188│         self._load_plugins(io)
      189│
    → 190│         exit_code: int = super()._run(io)
      191│         return exit_code
      192│

  7  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\application.py:431 in _run
      429│             io.input.interactive(interactive)
      430│
    → 431│         exit_code = self._run_command(command, io)
      432│         self._running_command = None
      433│

  6  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\application.py:473 in _run_command
      471│
      472│         if error is not None:
    → 473│             raise error
      474│
      475│         return terminate_event.exit_code

  5  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\application.py:457 in _run_command
      455│
      456│             if command_event.command_should_run():
    → 457│                 exit_code = command.run(io)
      458│             else:
      459│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  4  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\commands\base_command.py:117 in run
      115│         io.input.validate()
      116│
    → 117│         return self.execute(io) or 0
      118│
      119│     def merge_application_definition(self, merge_args: bool = True) -> None:

  3  .local\pipx\venvs\poetry@git\lib\site-packages\cleo\commands\command.py:61 in execute
       59│
       60│         try:
    →  61│             return self.handle()
       62│         except KeyboardInterrupt:
       63│             return 1

  2  .local\pipx\venvs\poetry@git\lib\site-packages\poetry\console\commands\new.py:62 in handle
       60│         readme_format = self.option("readme") or "md"
       61│
    →  62│         config = GitConfig()
       63│         author = None
       64│         if config.get("user.name"):

  1  .local\pipx\venvs\poetry@git\lib\site-packages\poetry\core\vcs\git.py:199 in __init__
      197│         try:
      198│             config_list = subprocess.check_output(
    → 199│                 [executable(), "config", "-l"], stderr=subprocess.STDOUT
      200│             ).decode()
      201│

  RuntimeError

  Unable to find a valid git executable

  at .local\pipx\venvs\poetry@git\lib\site-packages\poetry\core\vcs\git.py:182 in executable
      178│     else:
      179│         _executable = "git"
      180│
      181│     if _executable is None:
    → 182│         raise RuntimeError("Unable to find a valid git executable")
      183│
      184│     return _executable
      185│
      186│
@brycepg brycepg added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Dec 9, 2023
@dimbleby
Copy link
Contributor

dimbleby commented Dec 9, 2023

Duplicate #7320 please close

@radoering radoering added status/duplicate Duplicate issues and removed status/triage This issue needs to be triaged labels Dec 10, 2023
@radoering radoering closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2023
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

3 participants