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?
- Replaces multiple tools —
pip,virtualenv,pyenv,pipx, andpip-toolsare all replaced by one CLI. - Global cache — Shared package versions are stored once on disk, saving space and speeding up repeat environment setups.
- Python version management —
uvautomatically downloads and switches between different Python versions on the fly.
How to Install uv
You can install uv in one of two ways:
- Using pip — if you already have a Python environment set up on your machine:
pip install uv- Using the standalone installer — if you don't have Python set up yet,
uvcan manage Python versions for you too. See the official installation docs for all methods.
On Windows, run this inside 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:
uv python installList available Python versions:
uv python listInstall a specific Python version:
uv python install 3.12Install multiple versions at once:
uv python install 3.12 3.13How to Uninstall Python Using uv
uv python uninstall <target version>How to Initialize a Project (App) with uv
Create a project in the current working directory:
uv init .Create a project inside a new sub-directory:
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:
uv init . --bare
# or
uv init --bareSet up the project to be built as a Python package:
uv init --packageDo not set up the project as a Python package:
uv init --no-packageInitialize a project with a specific Python version:
uv init . --python 3.13How to Create a Virtual Environment with uv
If you've already initialized a project, uv sync will automatically create the virtual environment for you:
uv syncIf you want to create a virtual environment without an initialized project, use uv venv:
uv venvTo 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:
uv venv --python 3.13 .venv --clearNote: 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
.venvfolder doesn't exist in your project root,uv synccreates one automatically. - Installs missing packages — it reads your
uv.lockfile (generating one first if it's missing) and installs all declared dependencies. - Removes unlisted packages — it performs "environment pruning," meaning any packages found in
.venvthat are not in your lockfile are automatically deleted. - Updates changed versions — if you change a version constraint in
pyproject.toml, runninguv syncupdates 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-packagemode).
How to Install Packages with uv
Install a specific package:
uv add pandasInstall multiple packages at once:
uv add pandas matplotlibInstall from a requirements.txt file:
uv add -r requirements.txtInstall using the pip-compatible interface:
uv pip install fastapi[standard]How to Remove Packages with uv
Remove a package from your project's dependencies:
uv remove pandasRemove a package from a specific group (e.g. dev):
uv remove pytest --devHow to Update uv and Lock Dependencies
Update uv itself to the latest version:
uv self updateRegenerate the lockfile (uv.lock) after changing pyproject.toml, without installing anything:
uv lockUpgrade a specific package to the latest allowed version and update the lockfile:
uv lock --upgrade-package pandasHow 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:
uv add pytest --devCreate a custom group named lint and add the ruff package to it:
uv add ruff --group lintNote:
--devis simply a built-in shortcut for--group dev.
How to Export Dependencies to Another Format
Export to requirements.txt using the pip-compatible interface:
uv pip freeze > requirements.txtExport using uv's native export command:
uv export --no-hashes --format requirements.txt > requirements.txtHow 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:
uv python pin 3.13What 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
| Task | Old way | With uv |
|---|---|---|
| Install packages | pip install <package> | uv add <package> |
| Create virtual env | python -m venv .venv | uv venv |
| Manage Python versions | pyenv install 3.12 | uv python install 3.12 |
| Run isolated CLI tools | pipx install <tool> | uvx <tool> |
| Lock dependencies | pip-compile (pip-tools) | uv lock |
| Sync environment to lockfile | pip install -r requirements.txt | uv sync |
| Run a script with deps resolved | activate venv, then python script.py | uv 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.