Repository navigation
Closed
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expected
Description
- 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 (
-vvvoption).
- 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(
Reacted by Darren Alfonso, Jérôme Bon, Edgar Ramírez Mondragón, hiroshi.matsui, Santiago Hincapie, alm, Robert Mulley, Roelzkie, Angella Naigaga , David Flores and 18 more
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expected
Activity
finswimmer commentedon Jun 1, 2020
Hello @pawelrubin,
it looks a bit like
gitcannot find the branch. Can you try to clone the repository and checkout the branch in the target machine only withgit? At best, copy&paste the branch name to avoid oversee any minor typo.fin swimmer
balan-jayavictor commentedon Jul 14, 2020
The target here is a docker container (based on the image we provide) provisioned by Gitlab during the build time.
It works fine when running the docker container locally.
@pawelrubin did you manage to fix it / work around it?
guhcampos commentedon Aug 3, 2020
I believe this problem is related to something I've experienced.
It looks like
poetrywill clone the repository with it's default name duringpoetry addbut will try to infer the local repository name from the package name when doing anything else, so in my case I had something like:which cloned such repository under
$HOME/.cache/pypoetry/virtualenvs/myproject-pbdKQ0bZ-py3.6/src/mycompany-sdk/However, during a subsequent
poetry updateit failed with:Which makes total sense because there's no
mycompanydirectory there, the repository is calledmycompany-sdk, yet the package it contains is, indeed, namedmycompanyand that's why poetry thinks it should look for that package there.johnmee commentedon Sep 16, 2020
There does not appear to be any rush to fix this, so I guess there is a workaround. I wonder what that might be?
Perhaps delete the virtualenv and start over?
floi commentedon Oct 5, 2020
I had a similar issue with a dependency from a private Gitlab repository that used SSH for cloning (same
CalledProcessError). When testing in a local Docker container, I noticed that I had to actively confirm the server fingerprint. As git has no option for automatically doing that, I solved poetry's installation of dependencies in the Gitlab CI container by adding the fingerprint to~/.ssh/known_hostsbefore runningpoetry installin my.gitlab-ci.yml. Here's how I did that:~/.ssh/known_hosts.gitlab-ci.yml, add the following lines before callingpoetry install:I'm aware that the problem in the original comment might be something else (given that you, @pawelrubin, were trying to clone via HTTPS from a public repository), but maybe this will help other people ending up here when researching that error message.
bolbken commentedon Oct 7, 2021
I know this is old... but a cleaner alternative that I found for github, guessing gitlab is similar
joooeey commentedon Oct 29, 2021
I had a similar issue and it turns out the problem was that the library I was referring to (
sentinelsat) had nomasterbranch because they renamed their main branch tomain. Since a lot of repositories have done that in the last few years, that might be the problem.Adding the
branchrequirement inpyproject.tomlworked for me:This problem already has an issue at #3366.
mecampbellsoup commentedon Dec 16, 2021
Experiencing this issue w/ a public GitHub repo.
Here is my Poetry config:
And here at the GitLab CI Logs:
Anyone aware of a workaround?
mrcljx commentedon Jan 5, 2022
In case it helps anyone: I had the same "returned non-zero exit status 128" issue. I investigated it by just running this:
It turned out that /usr/local/src did not exist / wasn't writable, so totally a problem on my end. It would really be nice if Poetry could log the stderr of Git to make debugging situations like this easier.
For those wondering: The path is coming from the pip_installer which uses
sys.prefix / "src"luni3359 commentedon Jan 14, 2022
@mrcljx Do you think you could explain what you changed? I tried the following:
but it's still giving me the same error:
This dependency is written in
pyproject.tomlas follows:The container is created without an issue if I run everything as root. Are you running Poetry as root?
phenry2 commentedon Jan 18, 2022
Experiencing exactly the same issue with 2 out of 4 github repositories. What the two that are failing have in common is that they both have submodules. Turns out I'd made a change to the way the submodules were being referenced.
I was able to identify the issue by manually adding
git clone --recurse-submodules -- https://git@github.com/xxx/xxx.git /usr/local/src/xxx/xxxinto the pipeline to see what the real error was. Turns out the submodules were using the url https://github.com, whereas their parents were accessed through https://git@github.com. I'd applied the following to ensure the PAT was being set for git@github.com;This was not applying to the submodule and I got an authentication error when it tried to clone the submodule. I solved this by just updating the url to the submodules in .gitmodules.
This may not be the same issue as exit status code 1 is rather uninformative, but adding the command manually to your pipeline should reveal the true cause.
ryo-matsuzaka commentedon Jan 18, 2022
@phenry2
Thank you for timely comments.
I had just the similar issue. I could solved it.
TinDang97 commentedon Mar 8, 2022
I just add
#mainat the end. It's worked. :Dabn commentedon Apr 8, 2022
Sounds like ^ was a default branch issue. #5428 should handle this cleaner. Would be great to get that changes tested by folks who have been having issues here.
abn commentedon May 2, 2022
Resolved-by: #5428
simon-liebehenschel commentedon Jun 16, 2022
This fails with the latest Poetry:
Commands:
curl -sSL https://install.python-poetry.org | python3 - poetry install --no-interaction --no-ansi --no-root --no-devTraceback:
mkniewallner commentedon Jun 16, 2022
#5428 was merged against
masterbranch, which corresponds to version1.2of Poetry, which is still in beta.Could you try on latest beta?
curl -sSL https://install.python-poetry.org | python3 - --previewOtherwise, for
1.1, #2475 (comment) may also fix the issue, as mentioned.janbaykara commentedon Aug 17, 2022
Tried upgrading to the preview version
1.2.0b3and now getting another error. Neither the 1.1 comment nor upgrading has worked forpoetry add git+https://github.com/commonknowledge/wagtail-localize.git#mainisosphere commentedon Sep 23, 2022
This set me on the right track. It wasn't at all clear to me that there was a problem fetching a particular dependency via git from the error. If I had been told more explicitly "failed to get bla from git @ address" by poetry I might have been able to handle this on my own.
tkaessmann commentedon Nov 7, 2022
Thx so much for your help. Same problem here. But we've fixed it by setting:
poetry config virtualenvs.create true && poetry config virtualenvs.in-project trueIn my understanding the clone then will put the repo content inside the virtualenv instead of trying to place it into /usr/...
github-actions commentedon Mar 1, 2024
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.