Skip to content

UV Installation

The Duskfall Portal Crew edited this page May 7, 2025 · 1 revision

UV (Ultra Violet) - Faster Python Dependency Management

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.

Table of Contents

  1. Why Use UV?
  2. Installing UV
  3. Using UV in Your Project
  4. Advantages in This Project
  5. Troubleshooting
  6. Further Information

1. Why Use UV?

  • Speed: UV is designed for speed. It's significantly faster than pip for 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.

2. Installing UV

UV can be installed using pip, or you may install it by using other means. However, pip is highly recommended.

  1. Using Pip:

    pip install uv

    Make sure you have Python installed and pip available.

  2. Confirm Installation:

    uv --version

    This command should display the UV version if the installation was successful.

3. Using UV in Your Project

Once UV is installed, you can use it to manage your project's dependencies.

  1. Replacing Pip: To replace pip with uv, you'll generally use the uv pip command instead of the standard pip. 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
  2. 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

4. Advantages in This Project

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.

5. Troubleshooting

  • 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 pip for that package only (e.g., pip install <problematic-package>). This shouldn't happen often, as UV strives for compatibility.

6. Further Information

Clone this wiki locally