Skip to content

How to fix "No `project` Table Found" error in uv

uv

uv project commands (uv run, uv sync, uv add) expect a [project] table in pyproject.toml. Without one, uv reports:

error: No `project` table found in: `/path/to/pyproject.toml`

This happens in two common situations: a repository uses pyproject.toml only for tool configuration (Ruff, Black, mypy) without declaring a project, or a pyproject.toml was created manually and the [project] table was omitted.

Add a [project] table

If the directory is a Python project, add the required table to pyproject.toml:

[project]
name = "your-project-name"
version = "0.1.0"
requires-python = ">=3.10"

Or let uv generate it:

$ uv init

uv init creates a pyproject.toml with [project] metadata pre-filled. If the file already exists, uv merges the [project] table into it while preserving existing tool configuration sections.

Skip project discovery with --no-project

If the directory is not a Python project (for example, a repo that only stores Ruff or pytest configuration), pass --no-project to bypass the check:

$ uv run --no-project python script.py

This tells uv to ignore the pyproject.toml and run without a project context, the same behavior as if no pyproject.toml existed.

Use --script for standalone scripts

If the script uses inline metadata instead of a project-level pyproject.toml, run it with the --script flag:

$ uv run --script script.py

This reads dependencies from the script’s own # /// script block rather than looking for a [project] table.

Related

Last updated on

Please submit corrections and feedback...