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

unexpected end of file during wheel download #2586

Closed
newne opened this issue Mar 21, 2024 · 11 comments
Closed

unexpected end of file during wheel download #2586

newne opened this issue Mar 21, 2024 · 11 comments
Labels
network Network connectivity e.g. proxies, DNS, and SSL

Comments

@newne
Copy link

newne commented Mar 21, 2024

ubuntu 22.04
uv 0.1.23
when exec " uv pip install ultralytics", it failed with :

Resolved 53 packages in 11ms
error: Failed to download distributions
  Caused by: Failed to fetch wheel: nvidia-cufft-cu12==11.0.2.54
  Caused by: Failed to extract archive
  Caused by: request or response body error: error reading a body from connection: unexpected end of file
  Caused by: error reading a body from connection: unexpected end of file
  Caused by: unexpected end of file
@charliermarsh
Copy link
Member

Are you seeing this for every package? Just for this one? Are you seeing it for this one package consistently? Are you using any non-PyPI indexes?

@zanieb zanieb added the needs-mre Needs more information for reproduction label Mar 21, 2024
@newne
Copy link
Author

newne commented Mar 22, 2024

Are you seeing this for every package? Just for this one? Are you seeing it for this one package consistently? Are you using any non-PyPI indexes?

No, I try "uv pip install ultralytics" for three times but it comes out the same error. I install pandas with uv successfully:

 uv pip install pandas
Resolved 6 packages in 1.38s
Downloaded 2 packages in 12.07s
Installed 6 packages in 14ms
 + numpy==1.26.4
 + pandas==2.2.1
 + python-dateutil==2.9.0.post0
 + pytz==2024.1
 + six==1.16.0
 + tzdata==2024.1

This is a new conda env, all I do was :

conda create -n yolo python=3.10
uv pip install ultralytics
uv pip install ultralytics
uv pip install ultralytics
uv pip install pandas

@zanieb
Copy link
Member

zanieb commented Mar 22, 2024

I cannot reproduce this on Linux or macOS, although the download takes quite some time on Linux.

❯ uv venv -p 3.10
Using Python 3.10.13 interpreter at: /home/mz/workspace/uv/bin/python3.10
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
❯ uv pip install ultralytics
Resolved 51 packages in 606ms
Downloaded 45 packages in 2m 31s
Installed 51 packages in 28.35s
 + certifi==2024.2.2
 + charset-normalizer==3.3.2
 + contourpy==1.2.0
 + cycler==0.12.1
 + filelock==3.13.1
 + fonttools==4.50.0
 + fsspec==2024.3.1
 + idna==3.6
 + jinja2==3.1.3
 + kiwisolver==1.4.5
 + markupsafe==2.1.5
 + matplotlib==3.8.3
 + mpmath==1.3.0
 + networkx==3.2.1
 + numpy==1.26.4
 + nvidia-cublas-cu12==12.1.3.1
 + nvidia-cuda-cupti-cu12==12.1.105
 + nvidia-cuda-nvrtc-cu12==12.1.105
 + nvidia-cuda-runtime-cu12==12.1.105
 + nvidia-cudnn-cu12==8.9.2.26
 + nvidia-cufft-cu12==11.0.2.54
 + nvidia-curand-cu12==10.3.2.106
 + nvidia-cusolver-cu12==11.4.5.107
 + nvidia-cusparse-cu12==12.1.0.106
 + nvidia-nccl-cu12==2.19.3
 + nvidia-nvjitlink-cu12==12.4.99
 + nvidia-nvtx-cu12==12.1.105
 + opencv-python==4.9.0.80
 + packaging==24.0
 + pandas==2.2.1
 + pillow==10.2.0
 + psutil==5.9.8
 + py-cpuinfo==9.0.0
 + pyparsing==3.1.2
 + python-dateutil==2.9.0.post0
 + pytz==2024.1
 + pyyaml==6.0.1
 + requests==2.31.0
 + scipy==1.12.0
 + seaborn==0.13.2
 + six==1.16.0
 + sympy==1.12
 + thop==0.1.1.post2209072238
 + torch==2.2.1
 + torchvision==0.17.1
 + tqdm==4.66.2
 + triton==2.2.0
 + typing-extensions==4.10.0
 + tzdata==2024.1
 + ultralytics==8.1.30
 + urllib3==2.2.1

What happens if you just install the problematic package? e.g.

❯ uv pip install --no-cache nvidia-cufft-cu12==11.0.2.54
Resolved 1 package in 132ms
Downloaded 1 package in 4.81s
Installed 1 package in 169ms
 + nvidia-cufft-cu12==11.0.2.54

@zanieb zanieb changed the title Error when install package unexpected end of file during wheel download Mar 22, 2024
@newne
Copy link
Author

newne commented Mar 22, 2024

uv pip install ultralytics

(ncg) (base) ncg@ncg-pc:~$ uv pip install ultralytics
Resolved 51 packages in 11ms
error: Failed to download distributions
  Caused by: Failed to fetch wheel: nvidia-cuda-cupti-cu12==12.1.105
  Caused by: Failed to extract archive
  Caused by: request or response body error: error reading a body from connection: unexpected end of file
  Caused by: error reading a body from connection: unexpected end of file
  Caused by: unexpected end of file
(ncg) (base) ncg@ncg-pc:~$ uv pip install nvidia-cuda-cupti-cu12==12.1.105
Resolved 1 package in 0.43ms
Downloaded 1 package in 13.61s
Installed 1 package in 1ms
 + nvidia-cuda-cupti-cu12==12.1.105

but I still can't install the ‘ultralytics’ package:

(ncg) (base) ncg@ncg-pc:~$ uv pip install ultralytics
Resolved 51 packages in 10ms
error: Failed to download distributions
  Caused by: Failed to fetch wheel: nvidia-cusparse-cu12==12.1.0.106
  Caused by: Failed to extract archive
  Caused by: request or response body error: error reading a body from connection: unexpected end of file
  Caused by: error reading a body from connection: unexpected end of file
  Caused by: unexpected end of file
(ncg) (base) ncg@ncg-pc:~$ uv pip install nvidia-cusparse-cu12==12.1.0.106
Resolved 2 packages in 0.50ms
error: Failed to download distributions
  Caused by: Failed to fetch wheel: nvidia-cusparse-cu12==12.1.0.106
  Caused by: Failed to extract archive
  Caused by: request or response body error: error reading a body from connection: unexpected end of file
  Caused by: error reading a body from connection: unexpected end of file
  Caused by: unexpected end of file
(ncg) (base) ncg@ncg-pc:~$ uv pip install nvidia-cusparse-cu12
Resolved 2 packages in 1.96s
error: Failed to download distributions
  Caused by: Failed to fetch wheel: nvidia-cusparse-cu12==12.3.0.142
  Caused by: Failed to extract archive
  Caused by: request or response body error: error reading a body from connection: unexpected end of file
  Caused by: error reading a body from connection: unexpected end of file
  Caused by: unexpected end of file

@DanielYang59
Copy link

DanielYang59 commented May 13, 2024

We are getting this same error for uv pip install torch in CI materialsproject/pymatgen#3826:

error: Failed to download distributions
  Caused by: Failed to fetch wheel: torch==2.2.1
  Caused by: Failed to extract archive
  Caused by: error decoding response body
  Caused by: request or response body error
  Caused by: error reading a body from connection
  Caused by: end of file before message length reached

The failure seems quite intermittent.

@njzjz
Copy link

njzjz commented May 21, 2024

I got this error randomly when fetching large wheels:

https://github.com/njzjz/deepmd-kit/actions/runs/9182537910/job/25251596562#step:5:35

You can see in 12 jobs, it only happens once.

github-merge-queue bot pushed a commit to deepmodeling/deepmd-kit that referenced this issue Jun 21, 2024
…#3889)

This PR uses a shell wrapper to check if the `error decoding response
body` error message is in the uv stderr and retry if so. It is just a
workaround for astral-sh/uv#2586 and
astral-sh/uv#3514 and hope the upstream can
fix it.

Note that this PR does nothing with cibuildwheel. It's unclear how to
retry with certain errors under its complex logic (feature requested in
pypa/cibuildwheel#1846).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
- Standardized installation process for TensorFlow, Torch, and other
dependencies across workflows by using `uv_with_retry.sh` script to
ensure reliable installations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
github-merge-queue bot pushed a commit to deepmodeling/deepmd-kit that referenced this issue Jun 21, 2024
…#3889)

This PR uses a shell wrapper to check if the `error decoding response
body` error message is in the uv stderr and retry if so. It is just a
workaround for astral-sh/uv#2586 and
astral-sh/uv#3514 and hope the upstream can
fix it.

Note that this PR does nothing with cibuildwheel. It's unclear how to
retry with certain errors under its complex logic (feature requested in
pypa/cibuildwheel#1846).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
- Standardized installation process for TensorFlow, Torch, and other
dependencies across workflows by using `uv_with_retry.sh` script to
ensure reliable installations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
github-merge-queue bot pushed a commit to deepmodeling/deepmd-kit that referenced this issue Jun 21, 2024
…#3889)

This PR uses a shell wrapper to check if the `error decoding response
body` error message is in the uv stderr and retry if so. It is just a
workaround for astral-sh/uv#2586 and
astral-sh/uv#3514 and hope the upstream can
fix it.

Note that this PR does nothing with cibuildwheel. It's unclear how to
retry with certain errors under its complex logic (feature requested in
pypa/cibuildwheel#1846).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
- Standardized installation process for TensorFlow, Torch, and other
dependencies across workflows by using `uv_with_retry.sh` script to
ensure reliable installations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
njzjz added a commit to njzjz/deepmd-kit that referenced this issue Jul 2, 2024
…deepmodeling#3889)

This PR uses a shell wrapper to check if the `error decoding response
body` error message is in the uv stderr and retry if so. It is just a
workaround for astral-sh/uv#2586 and
astral-sh/uv#3514 and hope the upstream can
fix it.

Note that this PR does nothing with cibuildwheel. It's unclear how to
retry with certain errors under its complex logic (feature requested in
pypa/cibuildwheel#1846).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **Chores**
- Standardized installation process for TensorFlow, Torch, and other
dependencies across workflows by using `uv_with_retry.sh` script to
ensure reliable installations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
(cherry picked from commit 359d19b)
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
njzjz added a commit to deepmodeling/deepmd-kit that referenced this issue Jul 3, 2024
…#3889)

This PR uses a shell wrapper to check if the `error decoding response
body` error message is in the uv stderr and retry if so. It is just a
workaround for astral-sh/uv#2586 and
astral-sh/uv#3514 and hope the upstream can
fix it.

Note that this PR does nothing with cibuildwheel. It's unclear how to
retry with certain errors under its complex logic (feature requested in
pypa/cibuildwheel#1846).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **Chores**
- Standardized installation process for TensorFlow, Torch, and other
dependencies across workflows by using `uv_with_retry.sh` script to
ensure reliable installations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
(cherry picked from commit 359d19b)
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
@konstin konstin added network Network connectivity e.g. proxies, DNS, and SSL and removed needs-mre Needs more information for reproduction labels Jul 9, 2024
mtaillefumier pushed a commit to mtaillefumier/deepmd-kit that referenced this issue Sep 18, 2024
…deepmodeling#3889)

This PR uses a shell wrapper to check if the `error decoding response
body` error message is in the uv stderr and retry if so. It is just a
workaround for astral-sh/uv#2586 and
astral-sh/uv#3514 and hope the upstream can
fix it.

Note that this PR does nothing with cibuildwheel. It's unclear how to
retry with certain errors under its complex logic (feature requested in
pypa/cibuildwheel#1846).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
- Standardized installation process for TensorFlow, Torch, and other
dependencies across workflows by using `uv_with_retry.sh` script to
ensure reliable installations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@b-phi
Copy link

b-phi commented Oct 4, 2024

Also seeing this downloading large packages (~180MB) over slow network connections (~5MB/s)

@timonmerk
Copy link

+1 for the issue with installing PyTorch

@DanielYang59

This comment was marked as off-topic.

@Sytronik
Copy link

I also faced this error when downloading a large package (1.2GB) from my slow non-PyPI index server.

In my case, UV_CONCURRENT_DOWNLOADS=1 solved the issue.
I think we can confidently say the slow downloading causes this error.
In my case, I guess my index server is not fast enough to handle many concurrent connections.

@charliermarsh
Copy link
Member

We have more retries for these, including for these kind of "body" errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
network Network connectivity e.g. proxies, DNS, and SSL
Projects
None yet
Development

No branches or pull requests

9 participants