Skip to content
Advertisement

Pip build option to use multicore

I found that pip only use single core when it compiles packages. Since some python packages takes some time to build using pip, I’d like to utilize multicore on the machine. When using Makefile, I can do that like following command:

JavaScript

How can I achieve same thing for pip?

Advertisement

Answer

From what I can tell it does not look like pip has this ability but I may be mistaken.

To do multiprocessing in python you use the multiprocessing package, [here is a guide I found] (http://pymotw.com/2/multiprocessing/basics.html) about how to do it if you are interested and this is a link to the python docs that talk about it. I also found this question useful, Multiprocessing vs Threading Python, to make sure that multiprocessing did what I thought it did, being take advantage of multiple CPUs.

I have gone through the pip source code (available here) looking for a reference to the multiprocessing package and did not find any use of the package. This would mean that pip does not use/support multiprocessing. From what I can tell the /pip/commands/install.py file is the one of interest for your question as it is called when you run pip install <package>. For this file specifically the imports are

JavaScript

which you can see does not have any reference to the multiprocessing package but I did check all of the other files just to be sure.

Furthermore, I checked the pip install documentation and found no reference to installing using multiple cores.

TL;DR: Pip doesn’t do what you are asking. I may be wrong as I didn’t look at the source that long but I’m pretty sure it just doesn’t support it.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement