piwheels / packages

Issue tracker for piwheels package issues
https://github.com/piwheels/packages/issues
20 stars 5 forks source link

Package issue: Django 5.1rc1 checksum issue #465

Closed anze3db closed 3 months ago

anze3db commented 3 months ago

Package name

django

Package version

5.1rc1

PyPI URL

https://pypi.org/project/Django/5.1rc1/

piwheels URL

https://www.piwheels.org/project/django/

Python version

I am aware this is the issue tracker for a Python package index specifically for Raspberry Pi

I have checked for duplicate issues

I am the maintainer

More information

Installing the Django 5.1 RC1 fails on my Raspberry Pi 4 with the following error:

(.venv) home@raspberrypi:~/fedidevs $ pip install 'django==5.1rc1'
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting django==5.1rc1
  Downloading https://www.piwheels.org/simple/django/Django-5.1rc1-py3-none-any.whl (8.2 MB)
     ━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/8.2 MB 66.4 kB/s eta 0:01:26
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    django==5.1rc1 from https://www.piwheels.org/simple/django/Django-5.1rc1-py3-none-any.whl#sha256=c4757c4077938e63f9f54d781f77f5673f37469ee312b266d69dc79508ccfd3a:
        Expected sha256 c4757c4077938e63f9f54d781f77f5673f37469ee312b266d69dc79508ccfd3a
             Got        c20395a7e061523712f413ae17beafb5f2213faa172f960a9b1b158517b41eac

The previous version 5.1 version (5.1b1) as well as the latest stable version 5.0.7 install without issues though.

My Python version is 3.12.1 and the error also reproduces on 3.11.5

bennuttall commented 3 months ago

There's an FAQ about the hash mismatch issue: https://www.piwheels.org/faq.html

We don't support Python 3.12 so you're probably best off not using piwheels

anze3db commented 3 months ago

I've checked and I get the same exact error on Python 3.11 as well.

(.venv3.11) home@raspberrypi:~/djangorctest $ .venv3.11/bin/python --version
Python 3.11.5
(.venv3.11) home@raspberrypi:~/djangorctest $ .venv3.11/bin/python -m pip install django==5.1rc1
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting django==5.1rc1
  Downloading https://www.piwheels.org/simple/django/Django-5.1rc1-py3-none-any.whl (8.2 MB)
     ━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━ 3.6/8.2 MB 71.8 kB/s eta 0:01:04
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    django==5.1rc1 from https://www.piwheels.org/simple/django/Django-5.1rc1-py3-none-any.whl#sha256=c4757c4077938e63f9f54d781f77f5673f37469ee312b266d69dc79508ccfd3a:
        Expected sha256 c4757c4077938e63f9f54d781f77f5673f37469ee312b266d69dc79508ccfd3a
             Got        2d28e6e43a0c5a60491a269a4de2c01fc8b243367d587e45a9153f0d9e29e53f
anze3db commented 3 months ago

Looks like the root cause seemed to be in my connection. I tried downloading the whl file directly as instructed by the FAQ and I noticed that the download restarted a few times:

Saving to: ‘Django-5.1rc1-py3-none-any.whl’

Django-5.1rc1-py3-none-any.whl         24%[=================>                                                        ]   1.94M  61.4KB/s    in 38s

2024-08-01 22:56:47 (52.9 KB/s) - Read error at byte 2031891/8201361 (Error decoding the received TLS packet.). Retrying.

--2024-08-01 22:56:48--  (try: 2)  https://www.piwheels.org/simple/django/Django-5.1rc1-py3-none-any.whl
Connecting to www.piwheels.org (www.piwheels.org)|46.235.225.189|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8201361 (7.8M), 6169470 (5.9M) remaining
Saving to: ‘Django-5.1rc1-py3-none-any.whl’

Django-5.1rc1-py3-none-any.whl         61%[++++++++++++++++++==========================>                             ]   4.78M  74.5KB/s    in 45s

2024-08-01 22:57:34 (64.1 KB/s) - Read error at byte 5007723/8201361 (Error decoding the received TLS packet.). Retrying.

--2024-08-01 22:57:36--  (try: 3)  https://www.piwheels.org/simple/django/Django-5.1rc1-py3-none-any.whl
Connecting to www.piwheels.org (www.piwheels.org)|46.235.225.189|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8201361 (7.8M), 3193638 (3.0M) remaining
Saving to: ‘Django-5.1rc1-py3-none-any.whl’

Django-5.1rc1-py3-none-any.whl         92%[+++++++++++++++++++++++++++++++++++++++++++++======================>      ]   7.22M  79.0KB/s    in 35s

2024-08-01 22:58:11 (72.3 KB/s) - Read error at byte 7567555/8201361 (Error decoding the received TLS packet.). Retrying.

--2024-08-01 22:58:14--  (try: 4)  https://www.piwheels.org/simple/django/Django-5.1rc1-py3-none-any.whl
Connecting to www.piwheels.org (www.piwheels.org)|46.235.225.189|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8201361 (7.8M), 633806 (619K) remaining
Saving to: ‘Django-5.1rc1-py3-none-any.whl’

Django-5.1rc1-py3-none-any.whl        100%[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=====>]   7.82M  35.9KB/s    in 13s

2024-08-01 22:58:27 (46.9 KB/s) - ‘Django-5.1rc1-py3-none-any.whl’ saved [8201361/8201361]

I guess pip doesn't restart so the downloaded package ended up being corrupt and failing the checksum because of it.

I restarted the wifi on my raspberry pi and after that the issue was gone!

bennuttall commented 3 months ago

I've checked and I get the same exact error on Python 3.11 as well.

I'm sure, but we do not provide wheels for Python 3.11 so the only ones you can get from us are pure Python wheels which are usually available from PyPI. Our data centre is in London so maybe if you're in another country it will be slower. Where are you?

anze3db commented 3 months ago

I'm in Lisbon, so not that far away from London. It was very weird that the downloading from pypi worked, but it failed from piwheels. I have confirmed that the issue was on my side and the problem went away when I restarted the wifi on my device, but weird how network issues made me thing that there was something wrong with the package on piwheels.

I'm now digging through the pip source code, because I think pip should have raised a network error in this case and not a checksum error - if I got a network error I would have never suspected an issue with piwheels.

Sorry for wasting your time!