JRubics / poetry-publish

An action to build and publish python package to pypi (https://pypi.org/) using poetry (https://github.com/sdispater/poetry)
BSD 3-Clause "New" or "Revised" License
129 stars 17 forks source link

ModuleNotFoundError: No module named '_distutils_hack.override' #30

Closed jeriox closed 1 year ago

jeriox commented 1 year ago

When running v1.15 of the action, it fails with the following error during the poetry install step. Our test workflow is fine, so I suspect there is some problem in the python setup of the docker image

CalledProcessError

  Command '['/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--isolated', '--no-input', '--prefix', '/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11', '--no-deps', '/github/home/.cache/pypoetry/artifacts/82/cf/a3/28f141a1649242b80fd32ba63019a43b14c962cd53f37d817d2bedcaf4/lazy-object-proxy-1.8.0.tar.gz']' returned non-zero exit status 2.

  at /usr/local/lib/python3.11/subprocess.py:569 in run
       565│             # We don't call process.wait() as .__exit__ does that for us.
       566│             raise
       567│         retcode = process.poll()
       568│         if check and retcode:
    →  569│             raise CalledProcessError(retcode, process.args,
       570│                                      output=stdout, stderr=stderr)
       571│     return CompletedProcess(process.args, retcode, stdout, stderr)
       572│ 
       573│ 

The following error occurred when trying to handle this error:

  EnvCommandError

  Command ['/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--isolated', '--no-input', '--prefix', '/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11', '--no-deps', '/github/home/.cache/pypoetry/artifacts/82/cf/a3/28f141a1649242b80fd32ba63019a43b14c962cd53f37d817d2bedcaf4/lazy-object-proxy-1.8.0.tar.gz'] errored with the following return code 2, and output: 
  Processing /github/home/.cache/pypoetry/artifacts/82/cf/a3/28f141a1649242b80fd32ba63019a43b14c962cd53f37d817d2bedcaf4/lazy-object-proxy-1.8.0.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
  ERROR: Exception:
  Traceback (most recent call last):
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
      status = run_func(*args)
               ^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
      return func(self, options, args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 400, in run
      requirement_set = resolver.resolve(
                        ^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 73, in resolve
      collected = self.factory.collect_root_requirements(root_reqs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 491, in collect_root_requirements
      req = self._make_requirement_from_install_req(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 453, in _make_requirement_from_install_req
      cand = self._make_candidate_from_link(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 206, in _make_candidate_from_link
      self._link_candidate_cache[link] = LinkCandidate(
                                         ^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 297, in __init__
      super().__init__(
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 162, in __init__
      self.dist = self._prepare()
                  ^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 231, in _prepare
      dist = self._prepare_distribution()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 308, in _prepare_distribution
      return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 491, in prepare_linked_requirement
      return self._prepare_linked_requirement(req, parallel_builds)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 577, in _prepare_linked_requirement
      dist = _get_prepared_distribution(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 69, in _get_prepared_distribution
      abstract_dist.prepare_distribution_metadata(
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/distributions/sdist.py", line 61, in prepare_distribution_metadata
      self.req.prepare_metadata()
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/req/req_install.py", line 535, in prepare_metadata
      self.metadata_directory = generate_metadata(
                                ^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/operations/build/metadata.py", line 35, in generate_metadata
      distinfo_dir = backend.prepare_metadata_for_build_wheel(metadata_dir)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/utils/misc.py", line 706, in prepare_metadata_for_build_wheel
      return super().prepare_metadata_for_build_wheel(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_vendor/pep517/wrappers.py", line 189, in prepare_metadata_for_build_wheel
      return self._call_hook('prepare_metadata_for_build_wheel', {
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_vendor/pep517/wrappers.py", line 319, in _call_hook
      raise BackendUnavailable(data.get('traceback', ''))
  pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 77, in _build_backend
      obj = import_module(mod_path)
            ^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 940, in exec_module
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "/tmp/pip-build-env-pw0qfq_6/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 8, in <module>
      import _distutils_hack.override  # noqa: F401
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ModuleNotFoundError: No module named '_distutils_hack.override'

  at /usr/local/lib/python3.11/site-packages/poetry/utils/env.py:1540 in _run
      1536│                 output = subprocess.check_output(
      1537│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1538│                 )
      1539│         except CalledProcessError as e:
    → 1540│             raise EnvCommandError(e, input=input_)
      1541│ 
      1542│         return decode(output)
      1543│ 
      1544│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:

  PoetryException

  Failed to install /github/home/.cache/pypoetry/artifacts/82/cf/a3/28f141a1649242b80fd32ba63019a43b14c962cd53f37d817d2bedcaf4/lazy-object-proxy-1.8.0.tar.gz

  at /usr/local/lib/python3.11/site-packages/poetry/utils/pip.py:58 in pip_install
       54│ 
       55│     try:
       56│         return environment.run_pip(*args)
       57│     except EnvCommandError as e:
    →  58│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       59│ 
jeriox commented 1 year ago

the issue started appearing elsewhere now and I could trace it back to an outdated dependency, don't know why it only started showing here first.

JRubics commented 1 year ago

Hi, sorry for being late with the response and thank you for letting me know the issue is not on our side :slightly_smiling_face: