Skip to content

Display path to corrupted files when pip fails to load wheel #13147

@gaborbernat

Description

@gaborbernat

What's the problem this feature will solve?

This would help indentify the package that causes the problem.

Describe the solution you'd like

Currently when this happens one gets a stack trace of:

[2025-01-07T09:07:01.934Z] Successfully built pyspark

[2025-01-07T09:07:01.934Z] Installing collected packages: wcwidth, pytz, py4j, wrapt, urllib3, six, pyspark, propcache, prettytable, pluggy, packaging, numpy, multidict, jmespath, iniconfig, idna, fsspec, frozenlist, et-xmlfile, coverage, attrs, aioitertools, aiohappyeyeballs, yarl, python-dateutil, pytest, openpyxl, covdefaults, chispa,ai.remoteio, aiosignal, pytest-cov, pandas, botocore, aiohttp, aiobotocore, s3fs
[2025-01-07T09:07:01.934Z] test: exit 2 (32.29 seconds) /w> python -I -m pip install ai.remoteio chispa covdefaults numpy==1.26.4 openpyxl 'pandas<2' pyspark==3.5.0 pytest pytest-cov s3fs pid=108
[2025-01-07T09:07:01.934Z] ERROR: Exception:
[2025-01-07T09:07:01.934Z] Traceback (most recent call last):
[2025-01-07T09:07:01.934Z]   File "/w/.tox/test/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 105, in _run_wrapper
[2025-01-07T09:07:01.934Z]     status = _inner_run()
[2025-01-07T09:07:01.934Z]              ^^^^^^^^^^^^
[2025-01-07T09:07:01.934Z]   File "/w/.tox/test/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 96, in _inner_run
[2025-01-07T09:07:01.934Z]     return self.run(options, args)
[2025-01-07T09:07:01.934Z]            ^^^^^^^^^^^^^^^^^^^^^^^
[2025-01-07T09:07:01.934Z]   File "/w/.tox/test/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 67, in wrapper
[2025-01-07T09:07:01.934Z]     return func(self, options, args)
[2025-01-07T09:07:01.934Z]            ^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-01-07T09:07:01.934Z]   File "/w/.tox/test/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 457, in run
[2025-01-07T09:07:01.934Z]     installed = install_given_reqs(
[2025-01-07T09:07:01.934Z]                 ^^^^^^^^^^^^^^^^^^^
[2025-01-07T09:07:01.934Z]   File "/w/.tox/test/lib/python3.11/site-packages/pip/_internal/req/__init__.py", line 70, in install_given_reqs
[2025-01-07T09:07:01.934Z]     requirement.install(
[2025-01-07T09:07:01.934Z]   File "/w/.tox/test/lib/python3.11/site-packages/pip/_internal/req/req_install.py", line 867, in install
[2025-01-07T09:07:01.934Z]     install_wheel(
[2025-01-07T09:07:01.934Z]   File "/w/.tox/test/lib/python3.11/site-packages/pip/_internal/operations/install/wheel.py", line 732, in install_wheel
[2025-01-07T09:07:01.934Z]     _install_wheel(
[2025-01-07T09:07:01.934Z]   File "/w/.tox/test/lib/python3.11/site-packages/pip/_internal/operations/install/wheel.py", line 590, in _install_wheel
[2025-01-07T09:07:01.934Z]     file.save()
[2025-01-07T09:07:01.934Z]   File "/w/.tox/test/lib/python3.11/site-packages/pip/_internal/operations/install/wheel.py", line 380, in save
[2025-01-07T09:07:01.934Z]     shutil.copyfileobj(f, dest, blocksize)
[2025-01-07T09:07:01.934Z]   File "/opt/bb/lib/python3.11/shutil.py", line 197, in copyfileobj
[2025-01-07T09:07:01.934Z]     buf = fsrc_read(length)
[2025-01-07T09:07:01.934Z]           ^^^^^^^^^^^^^^^^^
[2025-01-07T09:07:01.934Z]   File "/opt/bb/lib/python3.11/zipfile.py", line 966, in read
[2025-01-07T09:07:01.934Z]     data = self._read1(n)
[2025-01-07T09:07:01.934Z]            ^^^^^^^^^^^^^^
[2025-01-07T09:07:01.934Z]   File "/opt/bb/lib/python3.11/zipfile.py", line 1034, in _read1
[2025-01-07T09:07:01.934Z]     data += self._read2(n - len(data))
[2025-01-07T09:07:01.934Z]             ^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-01-07T09:07:01.934Z]   File "/opt/bb/lib/python3.11/zipfile.py", line 1069, in _read2
[2025-01-07T09:07:01.934Z]     raise EOFError
[2025-01-07T09:07:01.934Z] EOFError

From this is not clear what package caused the issue.

Alternative Solutions

One can use PIP_DEBUG but that requires CI changes.

Additional context

Better error message.

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions