Handle multiple concurrent pip processes on the same environment
See original GitHub issueI saw that pip 6 added file-based locking to the http cache to avoid multi-process contention. Something should be done to handle multiple packages being installed into the same virtualenv at the same time. For example if I had a concurrent makefile that installed independent foo_webapp1
and foo_webapp2
packages with a common dependency on foo_core
, what would happen right now? What should happen? I guess the easiest is just to abort the second process.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Parallel Pip install - python - Stack Overflow
Parallel pip installation. This example uses xargs to parallelize the build process by approximately 4x. You can increase the parallelization factor with ...
Read more >concurrent-log-handler - PyPI
Concurrent Log Handler (CLH) is designed to allow multiple processes to write to the same logfile in a concurrent manner. It is important...
Read more >Speed Up Your Python Program With Concurrency
With multiprocessing , Python creates new processes. A process here can be thought of as almost a completely different program, though technically they're ......
Read more >Python Multiprocessing: The Complete Guide
Each process follows the same life cycle. Understanding the stages of this life-cycle can help when getting started with concurrent programming ...
Read more >Handling Concurrency Without Locks | Haki Benita
The problem with the naive implementation is that when multiple concurrent processes resolve the same short URL at the same time, the counter ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should still work. Could you file an issue with the failure logs and a reproducer for the behaviour you’re seeing?
Multiple invocations of pip in separate environments should work already. That’s literally what pip’s own test suite does.
In mypy we run our test suite in parallel. Some of our tests for PEP 561 require pip to install packages, so we’re recently run into some instability in our test suite. Note that each copy of pip is installed in its own venv. Sadly it seems that even with
--cache-dir
or--no-cache
there is some race happening that seems to cause the tests to fail intermittently.For now we will likely put a lock around package install, but it would be nice if @pradyunsg’s suggestion of throwing an error if pip is already running would be implemented, it would certainly have made it easier to discover what was going wrong with our tests 😃
What would the next steps be to get to concurrent pip? I imagine a list of all the places pip relies on global state would be a good start.