-
-
Notifications
You must be signed in to change notification settings - Fork 0
UV Installation
UV (Ultra Violet) is a blazingly fast Python package installer and resolver. It's designed as a drop-in replacement for pip and offers significant performance improvements, especially when dealing with complex projects and many dependencies.
- Why Use UV?
- Installing UV
- Using UV in Your Project
- Advantages in This Project
- Troubleshooting
- Further Information
-
Speed: UV is designed for speed. It's significantly faster than
pipfor installing and resolving dependencies. -
Compatibility: UV is designed to be a drop-in replacement for
pip, so you can use it without significant changes to your workflow. - Modern Features: UV incorporates modern features and optimizations to improve package management.
UV can be installed using pip, or you may install it by using other means. However, pip is highly recommended.
-
Using Pip:
pip install uv
Make sure you have Python installed and
pipavailable. -
Confirm Installation:
uv --version
This command should display the UV version if the installation was successful.
Once UV is installed, you can use it to manage your project's dependencies.
-
Replacing Pip: To replace
pipwithuv, you'll generally use theuv pipcommand instead of the standardpip. For example:-
Install Dependencies (from
requirements.txt):uv pip install -r requirements.txt
-
Install a Specific Package:
uv pip install <package-name>
-
Uninstall a Package:
uv pip uninstall <package-name>
-
List Installed Packages:
uv pip list
-
-
Virtual Environments with UV:
UV works well with virtual environments.
- Create a Virtual Environment (if you don't already have one):
This is optional, and is designed for isolation.
python -m venv .venv
-
Activate Your Virtual Environment: (Standard activation method for your system - see main documentation for details)
-
Install Dependencies Using UV Within the Activated Environment:
uv pip install -r requirements.txt
This specific project benefits from UV's speed during dependency installations. Using UV can significantly reduce the time it takes to set up your development environment or install dependencies for the first time.
-
Conflicts: If you encounter conflicts or issues, you may need to clean the cache.
uv cache clean
This will remove the cached files.
-
Incompatibility: If you find a specific package is not compatible with UV, you can use
pipfor that package only (e.g.,pip install <problematic-package>). This shouldn't happen often, as UV strives for compatibility.
- UV Documentation: Link to the official UV documentation - e.g., https://astral.sh/docs/uv/
- GitHub Repository: Link to the UV GitHub repository - e.g., https://github.com/astral-sh/uv