Skip to content

Wrongly recognized platform, unnecessary rebuilds #15799

@fleetingbytes

Description

@fleetingbytes

Summary

In a Python project which depends on cryptography and cffi I am facing unnecessary rebuilds with every uv run or uv sync because there appears to be a platform mismatch. My platform is FreeBSD 14.2-RELEASE amd64 (that's the output of uname -srm), yet in the log of uv sync --verbose I read:

The distribution is compatible with \x1b[36mFreeBSD\x1b[39m (`\x1b[36mfreebsd_14_2_release_amd64\x1b[39m`), but you're on \x1b[36mFreeBSD\x1b[39m (`\x1b[36mfreebsd_14_2_RELEASE_x86_64\x1b[39m`)

Here is a minimal reproducible example. cffi suffices as a dependency. We omit cryptography as it produces the same issue but a longer build time and longer log output:

uv init rebuild
cd rebuild
uv add cffi
RUST_LOG=trace uv sync --verbose

and here is the beginning of that log:

DEBUG uv 0.8.17 (21a92c163 2025-09-11)
DEBUG Found project root: `/home/fleetingbytes/src/rebuild`
DEBUG No workspace root found, using project root
TRACE Checking lock for `/home/fleetingbytes/src/rebuild` at `/tmp/uv-6ba0532bfdeb457a.lock`
DEBUG Acquired lock for `/home/fleetingbytes/src/rebuild`
DEBUG Reading Python requests from version file at `/home/fleetingbytes/src/rebuild/.python-version`
DEBUG Using Python request `3.11` from version file at `.python-version`
DEBUG Checking for Python environment at: `.venv`
TRACE Found cached interpreter info for Python 3.11.13, skipping query of: .venv/bin/python3
DEBUG The project environment's Python version satisfies the request: `Python 3.11`
TRACE The project environment's Python version meets the Python requirement: `>=3.11`
TRACE The virtual environment's Python interpreter meets the Python preference: `prefer managed`
DEBUG Released lock at `/tmp/uv-6ba0532bfdeb457a.lock`
TRACE Checking lock for `.venv` at `.venv/.lock`
DEBUG Acquired lock for `.venv`
DEBUG Using request timeout of 30s
DEBUG Found static `pyproject.toml` for: rebuild @ file:///home/fleetingbytes/src/rebuild
DEBUG No workspace root found, using project root
DEBUG Existing `uv.lock` satisfies workspace requirements
Resolved 3 packages in 0.98ms
DEBUG Using request timeout of 30s
TRACE Comparing installed with source: InstalledDist { kind: Registry(InstalledRegistryDist { name: PackageName("cffi"), version: "2.0.0", path: "/home/fleetingbytes/src/rebuild/.venv/lib/python3.11/site-packages/cffi-2.0.0.dist-info", cache_info: None, build_info: Some(BuildInfo { config_settings: ConfigSettings({}), extra_build_requires: [], extra_build_variables: {} }) }), metadata_cache: OnceLock(<uninit>), tags_cache: OnceLock(<uninit>) } Registry { specifier: VersionSpecifiers([VersionSpecifier { operator: Equal, version: "2.0.0" }]), index: Some(IndexMetadata { url: Pypi(VerbatimUrl { url: DisplaySafeUrl { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("pypi.org")), port: None, path: "/simple", query: None, fragment: None }, given: None }), format: Simple }), conflict: None }
DEBUG Platform tags mismatch for cffi==2.0.0: The distribution is compatible with \x1b[36mFreeBSD\x1b[39m (`\x1b[36mfreebsd_14_2_release_amd64\x1b[39m`), but you're on \x1b[36mFreeBSD\x1b[39m (`\x1b[36mfreebsd_14_2_RELEASE_x86_64\x1b[39m`)
DEBUG Requirement installed, but mismatched:
  Installed: InstalledDist { kind: Registry(InstalledRegistryDist { name: PackageName("cffi"), version: "2.0.0", path: "/home/fleetingbytes/src/rebuild/.venv/lib/python3.11/site-packages/cffi-2.0.0.dist-info", cache_info: None, build_info: Some(BuildInfo { config_settings: ConfigSettings({}), extra_build_requires: [], extra_build_variables: {} }) }), metadata_cache: OnceLock(<uninit>), tags_cache: OnceLock(Some(ExpandedTags([Small { small: WheelTagSmall { python_tag: CPython { python_version: (3, 11) }, abi_tag: CPython { gil_disabled: false, python_version: (3, 11) }, platform_tag: FreeBsd { release_arch: "14_2_release_amd64" } } }]))) }
  Requested: Registry { specifier: VersionSpecifiers([VersionSpecifier { operator: Equal, version: "2.0.0" }]), index: Some(IndexMetadata { url: Pypi(VerbatimUrl { url: DisplaySafeUrl { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("pypi.org")), port: None, path: "/simple", query: None, fragment: None }, given: None }), format: Simple }), conflict: None }
DEBUG Identified uncached distribution: cffi==2.0.0
TRACE Comparing installed with source: InstalledDist { kind: Registry(InstalledRegistryDist { name: PackageName("pycparser"), version: "2.23", path: "/home/fleetingbytes/src/rebuild/.venv/lib/python3.11/site-packages/pycparser-2.23.dist-info", cache_info: None, build_info: None }), metadata_cache: OnceLock(<uninit>), tags_cache: OnceLock(<uninit>) } Registry { specifier: VersionSpecifiers([VersionSpecifier { operator: Equal, version: "2.23" }]), index: Some(IndexMetadata { url: Pypi(VerbatimUrl { url: DisplaySafeUrl { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("pypi.org")), port: None, path: "/simple", query: None, fragment: None }, given: None }), format: Simple }), conflict: None }
DEBUG Requirement already installed: pycparser==2.23
TRACE Checking lock for `/home/fleetingbytes/.cache/uv/sdists-v9/pypi/cffi/2.0.0` at `/home/tejul/.cache/uv/sdists-v9/pypi/cffi/2.0.0/.lock`
DEBUG Acquired lock for `/home/fleetingbytes/.cache/uv/sdists-v9/pypi/cffi/2.0.0`
TRACE Response from https://files.pythonhosted.org/packages/eb/56/b1ba7935a17738ae8453301356628e8147c79dbb825bcbc73dc7401f9846/cffi-2.0.0.tar.gz is storable because it has a 'public' cache-control directive
TRACE Freshness lifetime found via cache-control max age setting: 365000000s
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/eb/56/b1ba7935a17738ae8453301356628e8147c79dbb825bcbc73dc7401f9846/cffi-2.0.0.tar.gz
   Building cffi==2.0.0

The full log is attached

full_log.txt

The same rebuild errors happen with ruff and ty dependencies 😟.

Platform

FreeBSD 14.2-RELEASE amd64

Version

uv 0.8.17 (21a92c1 2025-09-11)

Python version

Python 3.11.13

Metadata

Metadata

Assignees

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