Using uv for python projects

Kumar RajKumar Raj
5 min read

Why not pip, venv, pipenv, pyenv, poetry etc?

Firstly, it should be confusing to find pip and venv in the same line as they are fundamentally different. pip is the Package installer and venv is the Virtual Environment provided by default in python. The reason for them being listed together is, uv provides both.

pip + venv:

Don’t get me wrong. This is the default combination and for smaller projects, it’s fine. However, it doesn’t provide features that become indispensable for more serious projects:

  1. Dependency resolution is not optimized. I’ve had troubles in the past with this. Trust me, it’s not pleasant at all. The numpy version used by a package was causing the issue and the fix for that, as I discovered was to go into the requirements.txt file and remove the hard-coded version from there. After that, pip was able to figure out the right numpy version and hopefully it didn’t conflict with any other package.

  2. Lockfiles are not provided: We are supposed to use pip freeze » requirements.txt command to manually create the requirements.txt file. Firstly, it lists all the dependencies and makes it absolutely impossible to see the packages alone. Secondly, it’s not reproducible.

  3. Python version management: Both pip and venv don’t take into account the python version we are using or we are supposed to use. We need to have python already installed for them to work. This makes reproducible builds almost impossible without knowing the python version beforehand. It’s nasty and not professional at all.

  4. Speed optimization: 80-100x slower than uv

  5. Project level dependency management: We are supposed to manually activate the environment even if we are in the project directory. If we are not careful, then the packages are installed in our global environment. To make things worse, if you then activate the environment and install the package without specifying a version, pip will use the cached files and install the same version as the one available in the global environment, even if a newer version is available. This complete unawareness of project dynamics is appalling.

virtualenv:

It has more features than venv and it’s API is quite flexible. It’s also faster than traditional venv, using app data seed method.

  1. Package installation capabilities are not provided, just like pip+venv. Users are meant to manually create the requirements.txt file that comes with complexity and bad DX.

  2. Dependency resolution is as bad as venv

  3. Python version is not managed. Just like venv

  4. No lockfile, hence could be problematic for reproducing.

  5. No project level awareness

    It’s only slightly better than venv, and inherits similar issues.

conda/miniconda:

I know it’s a favorite among data scientists and that for good reasons. It provides Cross-Language Package Management (Python + system dependencies) which UV doesn’t provide. It’s also Project Aware, which is great. Manages the Python version and comes prepackaged with Scientific Computing Libraries which makes it an obvious choice for data engineers and data scientists.

  1. Slower than UV

  2. Not compatible with pip-first workflows.

  3. Huge download size.

  4. Slow dependency resolution for pure Python Projects.

    However, it must be kept in mind that Conda is excellent for data science purposes. I would choose UV over Conda unless I need some system dependencies.

poetry:

It’s one of the best Python Project managers out there. It provides Lockfile, pyproject.toml file and Project Scaffolding and Publishing features. We can also manage development specific dependencies separately like Node projects.

  1. Python version is not maintained. However, it’s easy to maneuver around by including it in our pyproject.toml file. The developer would still need to match the Python version manually.

  2. Slower than UV

  3. Doesn’t provide System Level dependency management.

  4. Not directly compatible with existing pip workflows

pyenv:

It’s great. Provides Python version management and even allows multiple Python Interpreters. It also provides Global and project-specific Python version settings.

  1. No Package Management capabilities : Honestly, it’s deal breaker. I hate managing a requirements.txt file with a passion.

  2. Dependency resolution is immature.

  3. No Project Awareness

  4. Extremely slow compared to UV

  5. Doesn’t provide Virtual Environment: Unbelievable

Let’s talk about UV now:

Deal Makers:

  1. Complete : Package Installation, Virtual Environment creation, Python Version Management and Project Management.

  2. Exceptionally Fast : 10-100x faster than pip

  3. Universal Lockfiles: Platform Independent uv.lock file for reproducibility

  4. Workspace support: Mutli-Project management in single workspace. Honestly, I’ve not played around with this feature yet.

  5. Python Version Management

  6. Backward Compatibility: Works with requirements.txt file and existing pip workflows.

  7. Single Binary: No python dependency. It’s installation is self-contained.

  8. Advanced Dependency Resolution: uses PubGrub Algorithm( No Idea what that is )

Cross Platform consistency: Same behavior across Windows, Linux and Mac OS

Limitations:

  1. Relatively New: However, it’s widely adopted already.

  2. Community support: Compared to something like Poetry which has a big Plugin and Integration ecosystem, it lacks community support.

  3. Documentation: It’s definitely not the best out there.

  4. Occasional Bugs: I hope it doesn’t remain this way for long.

Final Thoughts:

The fundamental difference is that traditional tools require multiple separate installations and complex tools coordination. For example, pip+virtualenv+pyenv+pipx for complete functionality, or Poetry+pyenv for modern project management or conda for scientific computing environments.

UV provides all of these capabilities in a single fast tool. It’s comprehensively simpler while also maintaining full compatibility with existing workflows.

I hope you enjoyed reading this article. Thanks for sticking around. Happy Coding !!!!

0
Subscribe to my newsletter

Read articles from Kumar Raj directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kumar Raj
Kumar Raj