ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE.
pip をアップデートしようとしたらハッシュが合わなくて怒られた。
$ pip install -U pip
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pip in /usr/lib/python3/dist-packages (20.3.4)
Collecting pip
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))': /simple/pip/pip-24.0-py3-none-any.whl
Downloading https://www.piwheels.org/simple/pip/pip-24.0-py3-none-any.whl (2.1 MB)
|█████████████████████████▋ | 1.7 MB 3.4 kB/s eta 0:02:03
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.
pip from https://www.piwheels.org/simple/pip/pip-24.0-py3-none-any.whl#sha256=da6b1e839e2fe6c03034a8987bc271d271cf32328e67126349d2eda92aabf3c3:
Expected sha256 da6b1e839e2fe6c03034a8987bc271d271cf32328e67126349d2eda92aabf3c3
Got 9397efdf4b412e8108527dfb1cbab0d40bf462a9e581abc7a5c62cf29affb3b8
$ pip cache purge や $ pip install --no-cache-dir -U pip などでキャッシュを消すと上手くいく、などと書かれている記事もあるが上手くいかない。
どうやら、エラー文に書かれている whl ファイルを wget や curl などで取得し、$ pip install <whl_file> とすると上手くいくらしい。
$ wget https://www.piwheels.org/simple/pip/pip-24.0-py3-none-any.whl --2024-04-20 23:19:49-- https://www.piwheels.org/simple/pip/pip-24.0-py3-none-any.whl Resolving www.piwheels.org (www.piwheels.org)... 2a00:1098:0:80:1000:3b:1:1, 2a00:1098:0:82:1000:3b:1:1, 46.235.225.189, ... Connecting to www.piwheels.org (www.piwheels.org)|2a00:1098:0:80:1000:3b:1:1|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2110226 (2.0M) Saving to: ‘pip-24.0-py3-none-any.whl’ pip-24.0-py3-none-any.whl 74%[===================================================================================> ] 1.50M 5.87KB/s in 4m 21s 2024-04-20 23:24:17 (5.90 KB/s) - Read error at byte 1572864/2110226 (Error decoding the received TLS packet.). Retrying. --2024-04-20 23:24:18-- (try: 2) https://www.piwheels.org/simple/pip/pip-24.0-py3-none-any.whl Connecting to www.piwheels.org (www.piwheels.org)|2a00:1098:0:80:1000:3b:1:1|:443... connected. HTTP request sent, awaiting response... 206 Partial Content Length: 2110226 (2.0M), 537362 (525K) remaining Saving to: ‘pip-24.0-py3-none-any.whl’ pip-24.0-py3-none-any.whl 100%[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++============================>] 2.01M 5.17KB/s in 95s 2024-04-20 23:25:58 (5.50 KB/s) - ‘pip-24.0-py3-none-any.whl’ saved [2110226/2110226] $ pip install pip-24.0-py3-none-any.whl Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Processing ./pip-24.0-py3-none-any.whl Installing collected packages: pip Successfully installed pip-24.0