question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`poetry install` fails when installing dependencies, from git repositories, in gitlab CI.

See original GitHub issue
  • 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).
  • OS version and name: python3.8 docker image
  • Poetry version: 1.0.5 (installed via pip3 install poetry)
  • Link of a Gist with the contents of your pyproject.toml file: link

Issue

poetry install fails when installing dependencies, from git repositories, in gitlab CI.

It does work on my local machine. Dependency has been added via poetry add git+https://github.com/devopshq/artifactory.git@support-python-38-glob Traceback from poetry install -vvv:

Installing dependencies from lock file

[CalledProcessError]
Command '['git', '--git-dir', '/tmp/pypoetry-git-artifactory60aj4enu/.git', '--work-tree', '/tmp/pypoetry-git-artifactory60aj4enu', 'checkout', 'support-python-38-glob']' returned non-zero exit status 1.

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/usr/local/lib/python3.8/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/usr/local/lib/python3.8/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/usr/local/lib/python3.8/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/usr/local/lib/python3.8/site-packages/poetry/console/commands/install.py", line 63, in handle
    return_code = installer.run()
  File "/usr/local/lib/python3.8/site-packages/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/usr/local/lib/python3.8/site-packages/poetry/installation/installer.py", line 225, in _do_install
    ops = solver.solve(use_latest=whitelist)
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/solver.py", line 36, in solve
    packages, depths = self._solve(use_latest=use_latest)
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/solver.py", line 180, in _solve
    result = resolve_version(
  File "/usr/local/lib/python3.8/site-packages/poetry/mixology/__init__.py", line 7, in resolve_version
    return solver.solve()
  File "/usr/local/lib/python3.8/site-packages/poetry/mixology/version_solver.py", line 80, in solve
    next = self._choose_package_version()
  File "/usr/local/lib/python3.8/site-packages/poetry/mixology/version_solver.py", line 355, in _choose_package_version
    packages = self._provider.search_for(dependency)
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/provider.py", line 130, in search_for
    packages = self.search_for_vcs(dependency)
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/provider.py", line 167, in search_for_vcs
    package = self.get_package_from_vcs(
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/provider.py", line 198, in get_package_from_vcs
    git.checkout(reference, tmp_dir)
  File "/usr/local/lib/python3.8/site-packages/poetry/vcs/git.py", line 217, in checkout
    return self.run(*args)
  File "/usr/local/lib/python3.8/site-packages/poetry/vcs/git.py", line 284, in run
    subprocess.check_output(["git"] + list(args), stderr=subprocess.STDOUT)
  File "/usr/local/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/lib/python3.8/site-packages/poetry/utils/_compat.py", line 205, in run
    raise CalledProcessError(

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:26
  • Comments:20 (4 by maintainers)

github_iconTop GitHub Comments

20reactions
joooeeycommented, Oct 29, 2021

I had a similar issue and it turns out the problem was that the library I was referring to (sentinelsat) had no master branch because they renamed their main branch to main. Since a lot of repositories have done that in the last few years, that might be the problem.

Adding the branch requirement in pyproject.toml worked for me:

sentinelsat = { git = "https://github.com/sentinelsat/sentinelsat.git", branch = "main" }

This problem already has an issue at #3366.

11reactions
guhcamposcommented, Aug 3, 2020

I believe this problem is related to something I’ve experienced.

It looks like poetry will clone the repository with it’s default name during poetry add but will try to infer the local repository name from the package name when doing anything else, so in my case I had something like:

poetry add git+ssh://git@git.mycompany.com:/mycompany-sdk.git

which cloned such repository under $HOME/.cache/pypoetry/virtualenvs/myproject-pbdKQ0bZ-py3.6/src/mycompany-sdk/

However, during a subsequent poetry update it failed with:

[CalledProcessError]
Command '['git', '--git-dir', '$HOME.cache/pypoetry/virtualenvs/myproject-pbdKQ0bZ-py3.6/src/mycompany/.git', '--work-tree', '$HOME/.cache/pypoetry/virtualenvs/myproject-pbdKQ0bZ-py3.6/src/mycompany', 'rev-parse', 'HEAD^{commit}']' returned non-zero exit status 128.

Which makes total sense because there’s no mycompany directory there, the repository is called mycompany-sdk, yet the package it contains is, indeed, named mycompany and that’s why poetry thinks it should look for that package there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry and GitLab: Devops for Python developers
This tutorial will show how to use both GitLab and Poetry and how a combination of these two tools can lead to an...
Read more >
Installing package with poetry in gitlab ci ... - Stack Overflow
I have an interesting situation where poetry works as expected locally (installing both the dependencies and my package), but in the GitLab ......
Read more >
Index · Dependency scanning · Application security · User · Help
GitLab checks the dependency scanning report, compares the found vulnerabilities between the source and target branches, and shows the information on the merge ......
Read more >
Configuration | Documentation | Poetry - Python dependency ...
If you encounter any problems with it, set to true to use the system git backend. installer.max-workers #. Type: int. Default: number_of_cores +...
Read more >
Add ability to optionally ignore dev dependencies in Poetry ...
This was done to provide the ability to view what issues exist only within production. For Poetry, this would be the results of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found