-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
type: refactorRefactoring codeRefactoring code
Description
Description
The fastest way, and has been advised as the best way, to install Python packages is to use wheels.
However when you actually try to install ~1000 wheels from a single set of requirements there are significant performance bottlenecks in Pip
Expected behavior
Installing pre-resolved wheels offline should be very very fast
pip version
23.3.dev0
Python version
Python 3.11
OS
Linux
How to Reproduce
python3.11 -m venv .venv
source .venv/bin/activate
- <install latest/dev pip>
git clone https://github.com/home-assistant/core
cd core/
python -m pip download -d {download_directory} --prefer-binary -r requirements_all.txt
cd {download_directory}
for file in $(ls *.tar.gz); do pip wheel --no-deps "$file" && mv "$file" "$file".built ; done
for file in $(ls *.zip); do pip wheel --no-deps "$file" && mv "$file" "$file".built ; done
cd -
time python -m pip install --dry-run --only-binary=:all: --no-index --ignore-installed --find-links file://{download_directory} -r requirements_all.txt
Output
On my machine:
real 2m33.486s
user 2m31.886s
sys 0m1.568s
Running a profile on this I see pip._internal.utils.url.path_to_url
is called over 3,000,000 times and takes ~25% of the total run time.
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Metadata
Metadata
Assignees
Labels
type: refactorRefactoring codeRefactoring code