/errors/uv/no-pyproject-toml-found
uv: error: No `pyproject.toml` found in current directory or any parent directory
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · uv 0.12.19 (bea138450 2026-09-24 aarch64-pc-windows-msvc)updated
- tool
- uv
- exit code
- 2
- versions
- uv 0.5 – 0.12
- os
- any
error: No pyproject.toml found in current directory or any parent directory means a uv project command (uv add, uv remove, uv sync, uv lock, uv tree) found no pyproject.toml in the current folder or any folder above it. These commands edit and lock a project, so one must exist. Run uv init to create it (or change into the project folder), then repeat the command.
Reproduce it
uv add requestsOutput · exit 2
error: No `pyproject.toml` found in current directory or any parent directory
uv exits with code 2 for this error, not 1.
Fix
uv init --bare --name demo --python 3.13 -q
uv add --no-sync -q "six==1.16.0"
cat pyproject.tomlOutput
[project]
name = "demo"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = [
"six==1.16.0",
]--bare writes only pyproject.toml; plain uv init also creates README.md, .python-version and a package skeleton. --no-sync here only records the dependency and the lockfile without creating .venv.
Which uv command to use without a project
| Goal | Command |
|---|---|
| Add a dependency to a project | uv add PACKAGE (needs pyproject.toml) |
| Install into an existing virtual environment | uv pip install PACKAGE |
| Install from requirements.txt | uv pip install -r requirements.txt |
| Dependencies for one script | uv add --script script.py PACKAGE, then uv run script.py |
| Run a tool once | uvx TOOL (for example uvx ruff check) |
| Run a command in a project elsewhere | uv run --project PATH COMMAND |
Sources
Related pages
commands · uvuv init: create a new Python project with uvuv init NAME creates a Python project with pyproject.toml, README, .python-version and git. The --app, --lib, --package, --bare and --script layouts compared.commands · uvuv run script.py with inline dependencies (PEP 723)uv add --script writes a PEP 723 dependency block into a single-file Python script; uv run script.py installs those packages in a cached env and runs it.errors · uvuv: error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provideduv sync --locked fails when pyproject.toml changed but uv.lock was not regenerated. Run uv lock and commit uv.lock; --frozen skips the check entirely.