Python•September 5, 2026•

uv: The Complete Guide to Python’s Fastest Package Manager (2026)

A complete uv tutorial covering installation, Python version management, virtual environments, dependencies, dependency groups, and more — with a full video walkthrough.

uv is an extremely fast Python package and project manager, built to replace the patchwork of tools most Python developers juggle every day — pip, virtualenv, pyenv, pipx, and pip-tools. This guide walks through everything you need to get productive with uv, from installation to managing dependency groups, along with a full video walkthrough in Hindi.

What is uv?

uv is a Python package manager written in Rust, designed to be a single, fast replacement for the tools listed above.

Why Use uv Over Other Tools?

  1. Replaces multiple tools — pip, virtualenv, pyenv, pipx, and pip-tools are all replaced by one CLI.
  2. Global cache — Shared package versions are stored once on disk, saving space and speeding up repeat environment setups.
  3. Python version management — uv automatically downloads and switches between different Python versions on the fly.

How to Install uv

You can install uv in one of two ways:

  1. Using pip — if you already have a Python environment set up on your machine:
Bash
pip install uv
  1. Using the standalone installer — if you don't have Python set up yet, uv can manage Python versions for you too. See the official installation docs for all methods.

On Windows, run this inside PowerShell:

PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

How to Install Python Using uv

uv can download and manage Python versions for you directly — no separate installer needed.

Install Python:

Bash
uv python install

List available Python versions:

Bash
uv python list

Install a specific Python version:

Bash
uv python install 3.12

Install multiple versions at once:

Bash
uv python install 3.12 3.13

How to Uninstall Python Using uv

Bash
uv python uninstall <target version>

How to Initialize a Project (App) with uv

Create a project in the current working directory:

Bash
uv init .

Create a project inside a new sub-directory:

Bash
uv init <name of the folder>

If you only want a pyproject.toml and want to skip everything else — this disables creating extra files like README.md, the src/ tree, and .python-version:

Bash
uv init . --bare
# or
uv init --bare

Set up the project to be built as a Python package:

Bash
uv init --package

Do not set up the project as a Python package:

Bash
uv init --no-package

Initialize a project with a specific Python version:

Bash
uv init . --python 3.13

How to Create a Virtual Environment with uv

If you've already initialized a project, uv sync will automatically create the virtual environment for you:

Bash
uv sync

If you want to create a virtual environment without an initialized project, use uv venv:

Bash
uv venv

To specify a Python version for the virtual environment — this only raises a warning if the specified version isn't compatible with the project's requirements:

Bash
uv venv --python 3.13 .venv --clear

Note: running uv add <package> will also create the virtual environment automatically if one doesn't already exist.

What Does uv sync Actually Do?

  • Creates the virtual environment — if a .venv folder doesn't exist in your project root, uv sync creates one automatically.
  • Installs missing packages — it reads your uv.lock file (generating one first if it's missing) and installs all declared dependencies.
  • Removes unlisted packages — it performs "environment pruning," meaning any packages found in .venv that are not in your lockfile are automatically deleted.
  • Updates changed versions — if you change a version constraint in pyproject.toml, running uv sync updates that specific package in the environment.
  • Installs the local project — by default, it installs your current project into the environment in editable mode (unless you're running in --no-package mode).

How to Install Packages with uv

Install a specific package:

Bash
uv add pandas

Install multiple packages at once:

Bash
uv add pandas matplotlib

Install from a requirements.txt file:

Bash
uv add -r requirements.txt

Install using the pip-compatible interface:

Bash
uv pip install fastapi[standard]

How to Remove Packages with uv

Remove a package from your project's dependencies:

Bash
uv remove pandas

Remove a package from a specific group (e.g. dev):

Bash
uv remove pytest --dev

How to Update uv and Lock Dependencies

Update uv itself to the latest version:

Bash
uv self update

Regenerate the lockfile (uv.lock) after changing pyproject.toml, without installing anything:

Bash
uv lock

Upgrade a specific package to the latest allowed version and update the lockfile:

Bash
uv lock --upgrade-package pandas

How to Add Dependencies in Groups

In uv, you can create dependency groups for different purposes, since you don't need every package (like testing or linting tools) inside your production environment.

Add pytest to your dev dependencies only:

Bash
uv add pytest --dev

Create a custom group named lint and add the ruff package to it:

Bash
uv add ruff --group lint

Note: --dev is simply a built-in shortcut for --group dev.

How to Export Dependencies to Another Format

Export to requirements.txt using the pip-compatible interface:

Bash
uv pip freeze > requirements.txt

Export using uv's native export command:

Bash
uv export --no-hashes --format requirements.txt > requirements.txt

How to Pin a Python Version in uv

You can pin uv to use a specific Python version by default while initializing the project, if no version is explicitly specified. This works only for that particular workspace:

Bash
uv python pin 3.13

What Does uv run Do?

uv run makes sure that whatever is required to run your script or tool is available — without needing to manually activate the virtual environment first. It resolves dependencies, syncs the environment if needed, and runs your command inside it in one step.

uv vs pip vs pyenv vs virtualenv: Quick Comparison

TaskOld wayWith uv
Install packagespip install <package>uv add <package>
Create virtual envpython -m venv .venvuv venv
Manage Python versionspyenv install 3.12uv python install 3.12
Run isolated CLI toolspipx install <tool>uvx <tool>
Lock dependenciespip-compile (pip-tools)uv lock
Sync environment to lockfilepip install -r requirements.txtuv sync
Run a script with deps resolvedactivate venv, then python script.pyuv run script.py

uv doesn't just wrap these tools — it reimplements their functionality in Rust, which is a big part of why installs and syncs are dramatically faster than the pip-based equivalents.

Frequently Asked Questions

Is uv faster than pip?

Yes. uv is written in Rust and uses a global cache plus parallel downloads/installs, making it significantly faster than pip for both fresh installs and repeat environment setups.

Does uv replace pip completely?

uv replaces most day-to-day uses of pip, virtualenv, pyenv, pipx, and pip-tools. It also ships a uv pip interface for teams that want pip-compatible commands during migration.

Can I use uv with an existing Python project?

Yes. Run uv init --bare inside an existing project directory to add a pyproject.toml without scaffolding new files, then use uv add to start managing dependencies with uv.

Does uv work on Windows, macOS, and Linux?

Yes, uv is cross-platform and provides installers for all three.

What is the difference between uv sync and uv install?

uv doesn't have a separate install command for environments — uv sync is the command that installs dependencies from uv.lock into your virtual environment, creating both if they don't exist.

Conclusion

uv consolidates Python packaging, virtual environments, and Python version management into a single, fast tool — cutting out the friction of juggling pip, venv, pyenv, and pip-tools separately. Whether you're starting a new project or managing dependency groups across dev, lint, and production environments, uv handles it with one consistent CLI.

Watch the full walkthrough in the video above, and check the official uv documentation for more advanced usage.

Spread the word

Enjoyed this post? Share it with your network in a click.

TweetShare

Keep exploring

More posts about Python.