Faster pip installs: caching, bytecode compilation, and uv
Installing your Python application’s dependencies can be surprisingly slow.
Whether you’re running tests in CI, building a Docker image, or installing an application, downloading and installing dependencies can take a while.
So how do you speed up installation with pip
?
In this article I’ll cover:
- Avoiding the slow path of installing from source.
- The package cache.
- Bytecode compilation and how it interacts with installation and startup speed.
- Using
uv
, a faster replacement forpip
, and why it’s not always as fast as it might initially seem.
Avoiding installs from source
When you install a Python package, there are two ways you can install it, typically:
- The packaged up source file, often a
.tar.gz
with apyproject.toml
or