How to fix "No `project` Table Found" error in uv
When using uv’s project commands in repositories that contain a pyproject.toml file without a [project] table, you’ll encounter this error:
error: No `project` table found in: `/path/to/pyproject.toml`This commonly occurs in repositories that use pyproject.toml only for tool configuration (like Black, Ruff, or other development tools) but don’t define the project itself.
Understanding the Error
uv requires a [project] table in pyproject.toml when running project-related commands like uv run. This table defines essential metadata about your project, particularly its name.
Solution Options
Option 1: Add a Minimal [project] Table
The simplest solution is to add a minimal [project] table to the existing pyproject.toml:
[project]
name = "your-project-name"
version = "0.1.0"This satisfies uv’s requirements while maintaining compatibility with existing tool configurations.
Option 2: Use the --no-project Flag
For commands like uv run, add the --no-project flag to tell uv to ignore project detection:
uv run --no-project python script.pyThis flag instructs uv to operate in non-project mode, similar to how it would work if no pyproject.toml was present.