This skill should be used when the user asks about UV (Python package manager), needs to set up Python virtual environments, install/manage Python CLI tools, run MCP servers with UVX, decide between uv tool install vs uvx, configure VS Code or IDEs for MCP server integration, migrate from pip/pipx/poetry to UV, or troubleshoot UV-related issues. Use when queries mention UV, UVX, Python package management, virtual environments, MCP servers, tool installation, or Python version management.
UV is an extremely fast Python package and project manager written in Rust. This skill provides guidance on using UV for Python development, with particular focus on MCP (Model Context Protocol) server integration and modern tool management workflows.
UV replaces multiple tools: pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more - delivering 10-100x faster performance through intelligent caching and parallel operations.
Recommended Version: UV 0.9.7+ (Latest as of October 2025)
Before starting, check your UV version:
uv --version
Important Version-Specific Changes:
uv build --clear flag available for cleaning build artifactsIf your version is older than 0.9.0, upgrade for the best experience:
# Using pip
pip install --upgrade uv
# Or reinstall using official installer
# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# Unix/Mac
curl -LsSf https://astral.sh/uv/install.sh | sh
See Recent Changes Reference for detailed version information and migration guidance.
Use this skill when:
uv tool install vs uvx for package executionSkip this skill when:
UV provides several commands for different use cases:
| Command | Purpose | Example |
|---|---|---|
uv pip install | Install packages in current environment | uv pip install requests |
uv tool install | Install CLI tools globally with isolation | uv tool install black |
uvx | Execute packages in temporary environments | uvx mcp-server-sqlite |
uv venv | Create virtual environments | uv venv .venv |
uv python install | Install Python versions | uv python install 3.12 |
Need to run a Python package?
|
├─ Use daily/frequently?
| └─ YES → `uv tool install package`
| Examples: black, pytest, flake8, mypy
|
├─ MCP server?
| └─ YES → `uvx package` or `uvx --from path script.py`
| Examples: mcp-server-sqlite, custom MCP servers
|
├─ Testing/one-off execution?
| └─ YES → `uvx package`
| Examples: testing new tools, version comparison
|
└─ Local development script?
└─ YES → `uvx --from . script.py`
Examples: project-specific scripts
Published Packages (No working directory needed):
{
"servers": {
"sqlite": {
"command": "uvx",
"args": ["mcp-server-sqlite", "--db-path", "/path/to/db"]
}
}
}
Local Development (Use --from flag):
{
"servers": {
"my-server": {
"command": "uvx",
"args": [
"--from", "/absolute/path/to/project",
"server.py",
"--config", "config.json"
]
}
}
}
Key insight: --from flag IS the working directory reference for UVX.
UV works seamlessly with Python's built-in venv:
# Create virtual environment
python -m venv .venv
# Activate (Windows Git Bash)
. .venv/Scripts/activate
# Activate (Windows CMD)
.venv\Scripts\activate.bat
# Activate (Linux/Mac)
source .venv/bin/activate
# Install packages with UV
uv pip install -r requirements.txt
# Install development tools once
uv tool install black
uv tool install flake8
uv tool install mypy
uv tool install pytest
# Use daily
black .
flake8 src/
mypy src/
pytest tests/
# Test published MCP servers
uvx mcp-server-sqlite --db-path test.db
uvx mcp-server-git --repository /path/to/repo
# Local MCP server development
uvx --from /path/to/project server.py --env config.env
# Create new project with UV
uv init my-project
cd my-project
# Add dependencies
uv add requests fastapi
# Run project
uv run python main.py
# List available Python versions
uv python list
# Install default Python version (3.14 in UV 0.9.6+)
uv python install
# Install specific Python version
uv python install 3.12
uv python install 3.13
# Use in project
uv python pin 3.12
Note: As of UV 0.9.6, Python 3.14 is the default version. If you need Python 3.13 or earlier, explicitly specify the version.
UV supports defining dependencies directly in Python script comments:
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = [
# "requests",
# "pandas",
# ]
# ///
import requests
import pandas as pd
# Your code here
Run with automatic dependency installation:
# UV installs dependencies automatically
uv run script.py
Benefits:
See Inline Script Metadata Reference for comprehensive examples including MCP servers, web applications, data processing, and CLI tools.
For .vscode/mcp.json or user settings:
{
"servers": {
"published-server": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-server-sqlite", "--db-path", "${workspaceFolder}/db.sqlite"]
},
"local-dev": {
"type": "stdio",
"command": "uvx",
"args": [
"--from", "${workspaceFolder}",
"src/server.py"
]
}
}
}
For .continue/config.json:
{
"experimental": {
"modelContextProtocolServers": [
{
"transport": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-server-fetch"]
}
}
]
}
}
- name: Setup UV
uses: astral-sh/setup-uv@v1
- name: Install dependencies
run: uv pip install -r requirements.txt
- name: Run tests
run: uv run pytest
DO:
uv tool install for development tools used frequentlyuvx for MCP servers (follows community patterns)uv tool upgrade --allDON'T:
uv tool install (against community patterns)uvx for daily development tools (unnecessary overhead)DO:
--from for local development[email protected])DON'T:
@latest in production (unstable)--fromDO:
python -m venv for project environmentsuv pip install for faster package installationDON'T:
UV's performance advantages:
Typical operation times:
"spawn uvx ENOENT" Error:
Package Not Found:
--from pathpyproject.toml existsPermission Errors:
~/.cache/uv/Version Conflicts:
uv python pin to set project versionSee detailed troubleshooting in:
This skill includes detailed reference documentation:
Recent Changes ⭐ NEW
# Old way
pip install requests
# New way
uv pip install requests
# Old way
pipx install black
# New way
uv tool install black
# Old way
poetry add requests
poetry install
# New way
uv add requests
uv sync
UV provides a unified, fast, and modern approach to Python package management. The key to effective UV usage is:
By following these patterns and utilizing the reference documentation, you'll have a clean, efficient, and maintainable Python development environment.