Skip to content

Dependency Resolver Ignores Platform-Specific Version Constraints #9988

@merajhashemi

Description

@merajhashemi

Hello,

I want to bring up an issue again about PyTorch dependency resolution on Intel-based macOS. This follows the discussion in #9515, which I wasn’t able to reopen.

I really appreciate the updates with the fork-strategy option and the closure of issues #8686 and #7190, but the main problem I brought up is still there: the dependency resolver enforces a single version of PyTorch across all platforms, even when conditional version constraints are specified in pyproject.toml.

Here’s a minimal example of my configuration:

[project]  
name = "test"  
version = "0.1.0"  
description = "Add your description here"  
readme = "README.md"  
requires-python = ">=3.11"  
dependencies = [  
    "torch>1.13,<2.3; sys_platform == 'darwin' and platform_machine == 'x86_64'",  
    "torch>1.13; sys_platform != 'darwin' or platform_machine != 'x86_64'",  
]  

[tool.uv]  
fork-strategy = "requires-python"  

The expectation here is that the resolver should pick PyTorch version 2.2.2 for Intel MacOS, and a different version (e.g., 2.5.1) for other platforms. However, the current behavior enforces a single version (2.2.2) across all platforms.

I was hoping the introduction of the fork-strategy option would address this limitation, but it doesn’t seem to allow opting out of this unified resolution behavior.

Would it be possible to consider adding a new fork-strategy option (or another mechanism) to handle cases like this? This would allow for platform-specific resolution of dependencies as defined in the pyproject.toml.

Metadata

Metadata

Assignees

Labels

resolverRelated to the package resolver

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions