Skip to content

Conversation

@matteius
Copy link
Member

Summary

Fixes #6028

When a package has a sys_platform or other marker that doesn't match the current platform, skip adding it to the constraint set before resolution. This prevents pip from trying to resolve packages that don't exist for the current platform.

Problem

Previously, packages like:

[packages]
pywin32 = {version = "*", sys_platform = "== 'win32'"}

Would cause resolution failures on Linux because the constraint was added to pip's resolver even though the marker didn't match. The error would be:

ERROR: No matching distribution found for pywin32

Solution

Now, packages with non-matching markers are:

  1. Skipped from the constraint set before resolution
  2. Added to the skipped packages dict
  3. Still recorded in the lockfile with their markers

This allows cross-platform Pipfiles to work correctly - packages that don't apply to the current platform are simply skipped during resolution rather than causing errors.

Changes

  • pipenv/utils/resolver.py: Check marker evaluation before adding to constraints
  • tests/integration/test_lock.py: Add test for sys_platform key syntax

Testing

Added a new test test_resolve_skip_unmatched_sys_platform that verifies packages with non-matching sys_platform markers are properly skipped during resolution.


Pull Request opened by Augment Code with guidance from the PR author

When a package has a sys_platform or other marker that doesn't match
the current platform, skip adding it to the constraint set before
resolution. This prevents pip from trying to resolve packages that
don't exist for the current platform.

Previously, packages like:
  pywin32 = {version = "*", sys_platform = "== 'win32'"}

Would cause resolution failures on Linux because the constraint was
added to pip's resolver even though the marker didn't match.

Now, packages with non-matching markers are:
1. Skipped from the constraint set
2. Added to the skipped packages dict
3. Still recorded in the lockfile with their markers

Fixes #6028
@matteius matteius force-pushed the fix/sys-platform-resolution-6028 branch from f0e5bc7 to f4ec52d Compare December 15, 2025 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERROR: No matching distribution found for XXX (where XXX should be excluded by sys_platform)

2 participants