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

Missing git crashes the installation, even if not needed at all #2694

Closed
1 task
ChristianSauer opened this issue Jul 21, 2020 · 6 comments · Fixed by #5428
Closed
1 task

Missing git crashes the installation, even if not needed at all #2694

ChristianSauer opened this issue Jul 21, 2020 · 6 comments · Fixed by #5428
Labels
kind/bug Something isn't working as expected

Comments

@ChristianSauer
Copy link

  • [x ] I am on the latest Poetry version.
  • [x ] 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: Docker tiangolo/uvicorn-gunicorn-fastapi:python3.8-slim

DockerFile:

FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8-slim
RUN pip install poetry
COPY pyproject.toml .
RUN poetry install --no-dev

Issue

I would expect that the docker build works because the git dependency is a dev dependency and I asked for a --no-dev install. But poetry fails with this error:

[FileNotFoundError]
[Errno 2] No such file or directory: 'git'

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 69, 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 161, in _do_install
    ops = solver.solve(use_latest=self._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 388, in _choose_package_version
    version = self._provider.complete_package(version)
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/provider.py", line 601, in complete_package
    self.search_for_vcs(r)
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/provider.py", line 171, in search_for_vcs
    package = self.get_package_from_vcs(
  File "/usr/local/lib/python3.8/site-packages/poetry/puzzle/provider.py", line 204, in get_package_from_vcs
    git = Git()
  File "/usr/local/lib/python3.8/site-packages/poetry/vcs/git.py", line 168, in __init__
    self._config = GitConfig(requires_git_presence=True)
  File "/usr/local/lib/python3.8/site-packages/poetry/vcs/git.py", line 146, in __init__
    subprocess.check_output(
  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 188, in run
    process = Popen(*popenargs, **kwargs)
  File "/usr/local/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)

Also, the error could be better.
Thanks!

@ChristianSauer ChristianSauer added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jul 21, 2020
@etos
Copy link

etos commented May 18, 2022


  FileNotFoundError

  [Errno 2] No such file or directory: 'git'

  at /usr/local/lib/python3.8/subprocess.py:1704 in _execute_child
      1700│                     else:
      1701│                         err_filename = orig_executable
      1702│                     if errno_num != 0:
      1703│                         err_msg = os.strerror(errno_num)
    → 1704│                     raise child_exception_type(errno_num, err_msg, err_filename)
      1705│                 raise child_exception_type(err_msg)
      1706│
      1707│
      1708│         def _handle_exitstatus(self, sts, _WIFSIGNALED=os.WIFSIGNALED,

Much better error messaging required here.. or pre-check for git

@abn
Copy link
Member

abn commented May 18, 2022

This should be resolved with #5428.

Additionally, the OP's issue would also go away with including the lockfile in the build step. Otherwise, poetry will try to resolve metadata again.

@abn abn removed the status/triage This issue needs to be triaged label May 18, 2022
@abn abn closed this as completed May 18, 2022
@etos
Copy link

etos commented May 19, 2022

Many thanks, do you know when there will be a new pypi release?

@abn
Copy link
Member

abn commented May 19, 2022

Hopefully very soon. We are working towards that at the moment.

@cjjohansen
Copy link

Its also an issue for me when installing dependencies from own git repos

Copy link

github-actions bot commented 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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants