Skip to content

requires-python value discrepancy causes uv can't be used #612

@lemorage

Description

@lemorage

Problem

I’m a heavy uv user and tend to run all my Python projects through it. With uv, you can just prefix commands like pip or python—for example, uv pip install -e . or uv run python main.py. It makes managing virtual environments smoother.

But I ran into issues when trying to use it with some examples in this project.

For example,

☁  text_embedding [main] ⚡  uv run python main.py
  × No solution found when resolving dependencies for split (python_full_version == '3.10.*'):
  ╰─▶ Because the requested Python version (>=3.10) does not satisfy Python>=3.11 and cocoindex>=0.1.42 depends on Python>=3.11, we can conclude that
      cocoindex>=0.1.42 cannot be used.
      And because only the following versions of cocoindex are available:
          cocoindex<=0.1.42
          cocoindex==0.1.43
          cocoindex==0.1.44
          cocoindex==0.1.45
          cocoindex==0.1.46
          cocoindex==0.1.47
          cocoindex==0.1.48
          cocoindex==0.1.49
          cocoindex==0.1.50
      and your project depends on cocoindex>=0.1.42, we can conclude that your project's requirements are unsatisfiable.

      hint: The `requires-python` value (>=3.10) includes Python versions that are not supported by your dependencies (e.g., cocoindex>=0.1.42 only supports
      >=3.11). Consider using a more restrictive `requires-python` value (like >=3.11).

Suggested Solution

After digging a bit, I found this comment, which helped explain what’s going on.

Turns out, uv commands like uv run are high-level APIs that take the requires-python value from pyproject.toml seriously before even attempting to execute your code. So if that value isn’t accurate (like saying >=3.10 when your code or dependencies actually need >=3.11), uv assumes it can’t proceed—even if everything might work fine with regular python.

So to avoid this, we'd better make sure requires-python is properly aligned with the actual minimum version required by project dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions