Skip to content

/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

bash
uv add requests

Output · 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

bash
uv init --bare --name demo --python 3.13 -q
uv add --no-sync -q "six==1.16.0"
cat pyproject.toml

Output

[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

GoalCommand
Add a dependency to a projectuv add PACKAGE (needs pyproject.toml)
Install into an existing virtual environmentuv pip install PACKAGE
Install from requirements.txtuv pip install -r requirements.txt
Dependencies for one scriptuv add --script script.py PACKAGE, then uv run script.py
Run a tool onceuvx TOOL (for example uvx ruff check)
Run a command in a project elsewhereuv run --project PATH COMMAND

Sources