Skip to content

Concurrent execution of pip in multiple virtual environments fail (due to caching of packages) #12361

Closed
@freand76

Description

@freand76

Description

If multiple virtual environments are installing the same package at the same time one of them can/will fail with a cache error similar to the one below.

i.e. one virtual envioronment is downloading the file and caching it. Another virtual environment will try to access the cached file before the download has finished. This feature was working in 23.2.1.

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.
numpy>=1.20 from https://files.pythonhosted.org/packages/98/5d/5738903efe0ecb73e51eb44feafba32bdba2081263d40c5043568ff60faf/numpy-1.24.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Expected sha256 901677b9c6e0973ed91ece5a79fad3c42dafd884e1d7299cf5c392a7e7c62398
Got e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

Expected behavior

I expected the virtual environment either to download its own version of the package OR to wait for the cached version to be completed before accessing it.

pip version

23.3

Python version

3.8.10

OS

linux/ubuntu 20.04

How to Reproduce

Have multiple virtual environment running in parallel where at least some of the packages are shared between them.

Output

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.
numpy>=1.20 from https://files.pythonhosted.org/packages/98/5d/5738903efe0ecb73e51eb44feafba32bdba2081263d40c5043568ff60faf/numpy-1.24.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Expected sha256 901677b9c6e0973ed91ece5a79fad3c42dafd884e1d7299cf5c392a7e7c62398
Got e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions