Replacing pip with uv
Recently I discovered uv
as a potential replacement for pip
. A single use paid off the switching costs.
It has three main advantages over pip
:
- Speed
- Correctness
- Independence from the project
The speed advantage is obvious. The other two advantages warrant explanation.
I had installed Simon Willison’s excellent llm
CLI tool for LLM use. When I used pip freeze
to capture the current installation, it produced an invalid version for an sqlite3
library, necessitating a manual fix.
Some of my work uses FreeBSD. After installing the llm
plugin llm-gpt4all
, my project broke. Installation ran without error, but the plugin threw runtime error saying that FreeBSD is not supported. Failing to detect the lack of support at install time and relying on a run-time error is bad behavior to discuss elsewhere. At least the fix is easy, just uninstall llm-gpt4all
.
Not so fast! When attempting uninstall, pip
throws the same error! So pip
is hosed because the project is hosed.
I created a new setup with uv
instead of pip
and found that uv
freezes correct version numbers and also successfully uninstalls the module throwing the run-time error. That’s enough benefit to justify the switch.