Skip to content

uv sync removes necessary dependencies when two packages include the same module #15238

@jaseemabid

Description

@jaseemabid

Bug Description

uv sync --frozen --no-dev removes runtime dependencies (types-boto3-ecr)
even though they are required in the lock file.

Reproduction

The full project is here in a gist, but this is what I did to get there:

https://gist.github.com/jaseemabid/e2acd88b8ccb59e5d60b591247a4655c

This is a fairly tiny project with 2 runtime and 1 dev dependency.

❯ uv init
❯ uv add "boto3>=1.40"
❯ uv add "types-boto3-ecr>=1.40"

❯ uv add --dev "types-boto3[full]==1.40"
❯ uv sync

The full lockfile is included in the gist.

Expected vs Actual

I expected this to work fine, since the package is explicitly requested:

❯ uv run --no-dev python -c 'import types_boto3_ecr'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import types_boto3_ecr
ModuleNotFoundError: No module named 'types_boto3_ecr'

This only works without the --no-dev flag, but I can't tell why.

❯ uv run python -c 'import types_boto3_ecr'

Expected: types-boto3-ecr should be available (it's a runtime dependency)
Actual: ModuleNotFoundError - package is missing despite being in runtime
dependencies

This is pretty concerning that a package I have explicitly mentioned in
project.toml which UV also added to uv.lock isn't in the final virtual env.

I had runtime crashes because of this issue and it's kinda bad.

Environment

  • uv 0.8.6 (Homebrew 2025-08-07)
  • Python 3.13.6
  • Reproduced on macOS and Docker Linux

Platform

Darwin 24.6.0 arm64

Version

uv 0.8.6 (Homebrew 2025-08-07)

Python version

Python 3.13.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions