astral-sh/uv · error

Requesting extras requires a `pyproject.toml`, `setup.cfg`,

Error message

Requesting extras requires a `pyproject.toml`, `setup.cfg`, or `setup.py` file.

What it means

Error "Requesting extras requires a `pyproject.toml`, `setup.cfg`, or `setup.py` file." thrown in astral-sh/uv.

Source

Thrown at crates/uv/src/commands/pip/compile.rs:194

    // If `--python` / `-p` is a simple Python version request, we treat it as `--python-version`
    // for backwards compatibility. `-p` was previously aliased to `--python-version` but changed to
    // `--python` for consistency with the rest of the CLI in v0.6.0. Since we assume metadata is
    // consistent across wheels, it's okay for us to build wheels (to determine metadata) with an
    // alternative Python interpreter as long as we solve with the proper Python version tags.
    if python_version.is_none() {
        if let Some(request) = python.as_ref() {
            if let Ok(version) = PythonVersion::from_str(request) {
                python_version = Some(version);
                python = None;
            }
        }
    }

    // If the user requests `extras` but does not provide a valid source (e.g., a `pyproject.toml`),
    // return an error.
    if !extras.is_empty() && !requirements.iter().any(RequirementsSource::allows_extras) {
        return Err(anyhow!(
            "Requesting extras requires a `pyproject.toml`, `setup.cfg`, or `setup.py` file."
        ));
    }

    let client_builder = client_builder.clone().keyring(keyring_provider);

    // Read all requirements from the provided sources.
    let RequirementsSpecification {
        project,
        requirements,
        constraints,
        overrides,
        mut override_dependencies,
        excludes,
        pylock,
        source_trees,
        groups,
        extras: used_extras,

View on GitHub (pinned to f1a42680ff)

When it happens

Trigger: Thrown at crates/uv/src/commands/pip/compile.rs:194 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of astral-sh/uv@f1a42680ff (2026-08-16). Data as JSON: /api/errors/bcf9ba24ba281e85. Report an issue: GitHub.