Skip to content

fix: resolve rich platforms in workspace export conda-explicit-spec#6551

Open
MridulS wants to merge 2 commits into
prefix-dev:mainfrom
MridulS:fix/conda-explicit-spec-rich-platforms
Open

fix: resolve rich platforms in workspace export conda-explicit-spec#6551
MridulS wants to merge 2 commits into
prefix-dev:mainfrom
MridulS:fix/conda-explicit-spec-rich-platforms

Conversation

@MridulS

@MridulS MridulS commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

pixi workspace export conda-explicit-spec resolved each environment's platform in the lock file by subdir name via LockFile::platform(&platform.to_string()). Rich platforms (platforms carrying system-requirements) are keyed in the lock under generated aliases (p1, p2, ...) instead of their subdir, so the lookup returned None and the command failed with something like:

 platform 'osx-arm64' not found for env <env>

How Has This Been Tested?

I tested this out with this minimal example:

[workspace]
name = "pixi-test"
channels = ["conda-forge"]
platforms = [
  { platform = "linux-64", cuda = "12" },
  { platform = "osx-arm64", macos = "14.0" },
]

[dependencies]
numpy = "*"

With the latest pixi release:

$ pixi workspace export conda-explicit-spec spec-files/
Error:   × platform 'osx-arm64' not found for env default

With this PR it works as expected.

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.
  • I have verified that changes that would impact the JSON schema have been made in schema/model.py.

Comment on lines +111 to +118
// Resolve the conda subdir to the environment's platform entry. Rich
// platforms (platforms carrying system-requirements) are stored in the lock
// file under generated aliases (e.g. `p1`, `p2`) rather than their subdir
// name, so we cannot look them up by `platform.to_string()`. Instead, match
// on the subdir of each platform the environment actually provides.
let lock_platform =
env.platforms()
.find(|p| p.subdir() == *platform)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this just match any rich platform of the same subdir? What if there are multiple?

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.

2 participants