poetry: fails to install from git repo when commit doesn't belong to a branch

  • I am on the latest Poetry version.
  • 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).

Issue

https://github.com/KotlinIsland/basedtyping/runs/4741756977?check_suite_focus=true

  Stack trace:

  8  ~\.local\pipx\venvs\poetry\lib\site-packages\poetry\installation\executor.py:203 in _execute_operation
      201│ 
      202│             try:
    → 203│                 result = self._do_execute_operation(operation)
      204│             except EnvCommandError as e:
      205│                 if e.e.returncode == -2:

  7  ~\.local\pipx\venvs\poetry\lib\site-packages\poetry\installation\executor.py:277 in _do_execute_operation
      275│             return 0
      276│ 
    → 277│         result = getattr(self, "_execute_{}".format(method))(operation)
      278│
      279│         if result != 0:

  6  ~\.local\pipx\venvs\poetry\lib\site-packages\poetry\installation\executor.py:412 in _execute_install
      410│ 
      411│     def _execute_install(self, operation):  # type: (Install) -> None
    → 412│         return self._install(operation)
      413│
      414│     def _execute_update(self, operation):  # type: (Update) -> None

  5  ~\.local\pipx\venvs\poetry\lib\site-packages\poetry\installation\executor.py:431 in _install
      429│ 
      430│         if package.source_type == "git":
    → 431│             return self._install_git(operation)
      432│
      433│         if package.source_type == "file":

  4  ~\.local\pipx\venvs\poetry\lib\site-packages\poetry\installation\executor.py:576 in _install_git
      574│             reference = package.source_reference
      575│ 
    → 576│         git.checkout(reference, src_dir)
      577│
      578│         # Now we just need to install from the source directory

  3  ~\.local\pipx\venvs\poetry\lib\site-packages\poetry\core\vcs\git.py:281 in checkout
      279│         args += ["checkout", rev]
      280│
    → 281│         return self.run(*args)
      282│
      283│     def rev_parse(self, rev, folder=None):  # type: (str, Optional[Path]) -> str

  2  ~\.local\pipx\venvs\poetry\lib\site-packages\poetry\core\vcs\git.py:356 in run
      354│ 
      355│         return decode(
    → 356│             subprocess.check_output(
      357│                 [executable()] + list(args), stderr=subprocess.STDOUT
      358│             )

  1  ~\AppData\Local\Programs\Python\Python310\lib\subprocess.py:420 in check_output
       418│         kwargs['input'] = empty
       419│ 
    →  420│     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
       421│                **kwargs).stdout
       422│

  CalledProcessError

  Command '['C:\\Program Files\\Git\\cmd\\git.exe', '--git-dir', 'C:/Users/user/basedtyping/.venv/src/basedmypy/.git', '--work-tree', 'C:/Users/user/basedtyping/.venv/src/basedmypy', 'checkout', 'e5d40fc37d8d6eca75d8784020d82b4574b042b7']' returned non-zero exit status 128.

  at ~\.local\pipx\venvs\poetry\lib\site-packages\poetry\utils\_compat.py:217 in run
      213│                 process.wait()
      214│                 raise
      215│             retcode = process.poll()
      216│             if check and retcode:
    → 217│                 raise CalledProcessError(
      218│                     retcode, process.args, output=stdout, stderr=stderr
      219│                 )
      220│         finally:
      221│             # None because our context manager __exit__ does not use them.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 22 (11 by maintainers)

Most upvoted comments

I’ve faced the same issue with the following line:

fasttext = {git = "https://github.com/cfculhane/fastText"}

It worked with poetry==1.3.2, but doesn’t work with poetry=1.11.1, since… drum roll… the branch is named “main” and the old poetry by default use “master” branch. So it started working after I specified the commit:

fasttext = {git = "https://github.com/cfculhane/fastText", rev="4a44513"}

I think error messages can be greatly improved to show the reason of a failure like “Couldn’t checkout branch ‘master’”.

@LVladymyr The linked PR is in 1.2 milestone so there was no stable release of poetry with the fix yet. It should not be reproducible in latest 1.2.0 beta release.

Resolved-by: #5428

excellent. i can confirm with those commits, my test case no longer fails, and all of the dependencies are successfully installed, including the PR for Red-Lavalink. thanks!

@abn Good news / bad news.

With the help of a Red dev who recovered an older version of the branch: https://github.com/Kowlin/Red-DiscordBot/tree/V3/dpy2_unstable I was able to reproduce the issue using 1.2.0b1.

Unfortunately, when using poetry from your use-dulwich branch, it breaks again, only this time with a slightly different error, an AssertionError Invalid object name b'dpy2_unstable\n'

image