https://pantsbuild.org/ logo
#general
Title
# general
b

blue-football-92560

03/13/2023, 5:49 PM
Generating lockfiles takes 22 minutes for our repo. Is there a way to speed it up? Or at least get a rough idea of what is taking the most time?
Copy code
generate-lockfiles  0.27s user 0.05s system 0% cpu 22:26.65 total
Building a normal virtualenv with the same requirements only takes 6 minutes.
Copy code
pip install --no-cache-dir -r requirements.txt  268.47s user 34.02s system 89% cpu 5:38.85 total
h

high-yak-85899

03/13/2023, 5:51 PM
Building a virtual environment and generating a lockfile are two very different things
The former pins exact versions for all packages to a consistent state according to all transitive dependencies of every required package
The latter is just pip going through dependency by dependency and installing something that meets the bounds specified
It will gladly clobber other installs and create an end result that does not meet the needs of all the packages in the ecosystem (though it still may just work).
When this gets asked, the first place to look is how your interpreter constraints are set in
pants.toml
. A very wide bound means the constraint resolver has to operate on a much larger search space and consequently takes longer to complete.
There are quite a few threads in here already that will give some insight on how to check if things are poorly conditioned. So those will be a good first place to look.
Another good thread to read up on this for just the general challenge of the problem and things that take long even with a well-conditioned environment is here.