Environment
- pip version: pip 20.2.3
- Python version: Python 2.7 (32bit)
- OS: Windows 10 (64bit)
Description
We noticed pip will cache the http response for future installation. However if the cached http response includes corruped data (network issue for example), installing the same package will result in pip cache error as follow:
(venv2) H:\>pip install pyside
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting pyside
Using cached PySide-1.2.4-cp27-none-win32.whl (41.0 MB)
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.
pyside from https://files.pythonhosted.org/packages/39/78/2b5fcd3b4ff4fc891f1c3a8bee09616d59fa6d644b0dc6252d46d8fbb423/PySide-1.2.4-cp27-none-win32.whl#sha256=104c0f3aee597e92c43b60f31205cbbd57a4307fea0fae4bbaeeb58b61878908:
Expected sha256 104c0f3aee597e92c43b60f31205cbbd57a4307fea0fae4bbaeeb58b61878908
Got 9c9bdae0c8b07e8e834b3bd9f35ab93f3ddbae8365047b1596553eb70e996427
The symption of this issue has already been reported in pypi/warehouse#8330.
Expected behavior
If the error is caused by the data corruption in http response cache then pip should invalidate the cache and try to re-download for best attempt.
Currently pip cache purge will not clear http response cache. The only solution to this case is to remove http directory from the file system forcing pip to rebuild http cache.
How to Reproduce
- Create a Python 2 virtual environment
- Download the example corruped file https://mega.nz/file/WsthyLTS#AWD7NmS-w9B62Q3Y8Lb4SvCalqCb1d83a5FniKPmFqY
- Overwrite http folder in C:\Users<account name>\AppData\Local\pip\cache\http
- Uninstall pyside and install pyside by
pip install pyside
Output
(venv2) H:\>pip install pyside
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting pyside
Using cached PySide-1.2.4-cp27-none-win32.whl (41.0 MB)
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.
pyside from https://files.pythonhosted.org/packages/39/78/2b5fcd3b4ff4fc891f1c3a8bee09616d59fa6d644b0dc6252d46d8fbb423/PySide-1.2.4-cp27-none-win32.whl#sha256=104c0f3aee597e92c43b60f31205cbbd57a4307fea0fae4bbaeeb58b61878908:
Expected sha256 104c0f3aee597e92c43b60f31205cbbd57a4307fea0fae4bbaeeb58b61878908
Got 9c9bdae0c8b07e8e834b3bd9f35ab93f3ddbae8365047b1596553eb70e996427
Environment
Description
We noticed pip will cache the http response for future installation. However if the cached http response includes corruped data (network issue for example), installing the same package will result in pip cache error as follow:
The symption of this issue has already been reported in pypi/warehouse#8330.
Expected behavior
If the error is caused by the data corruption in http response cache then pip should invalidate the cache and try to re-download for best attempt.
Currently
pip cache purgewill not clear http response cache. The only solution to this case is to remove http directory from the file system forcing pip to rebuild http cache.How to Reproduce
pip install pysideOutput