Skip to content

[Bug] Host environment fails to link packages (same root cause as #2236) #2277

@ctcjab

Description

@ctcjab

Description

Host environment installation fails with "failed to link" error in v0.58.4. This appears to be the same cache conflict issue that was fixed for test environments in #2236, but the fix was not applied to host/build environment setup.

Reproduction

Building a noarch Python package intermittently fails during host environment installation:

recipe.yaml:

package:
  name: "test_package_stamped"
  version: "${{ version }}"

source:
  path: .

build:
  noarch: python
  string: py_0
  script:
    - python -m pip install . -vv --no-deps

tests:
  - script:
    - "true"

requirements:
  host:
    - python
    - pip
    - setuptools
  run:
    - python

Error Output (v0.58.4)

╭─ Running build for recipe: test_package_stamped-0.0.0.dev0-py_0
│
│ ╭─ Fetching source code
│ │ Fetching source from path: ...
│ │ Copied 5 files into isolated environment
│ │
│ ╰─────────────────── (took 0 seconds)
│
│ ╭─ Resolving environments
│ │ 
│ │ Resolving host environment:
│ │   Platform: linux-64 [__unix=0=0, __linux=6.1.124=0, __glibc=2.34=0, ...]
│ │   Channels: 
│ │    - file:///.../output/
│ │    - https://artifactory.example.com/.../
│ │   Specs:
│ │    - python
│ │    - pip
│ │    - setuptools
│ │ 
│ │ [table showing python 3.13.12, pip, setuptools resolved]
│ │
│ ╰─────────────────── (took 11 seconds)
│ 
│ Installing build environment
│  Successfully updated the build environment
│ 
│ Installing host environment
│
╰─────────────────── (took 11 seconds)
Error:   × Failed to resolve dependencies: failed to link python-3.13.12-
  │ hc97d973_100_cp313.conda

Analysis

The fix in #2236 (commit a311e7c) introduced layered PackageCache for test environments:

use PackageCache::new_layered with the temp dir as the writable layer and the global cache as a read-only fallback

However, this fix was only applied to test environment setup. Host and build environment installation still use the global package cache directly, which can have the same cache key conflicts that caused #2236.

Expected Behavior

Host environment installation should succeed. The layered PackageCache approach used for test environments should also be applied to host/build environment setup to avoid cache conflicts.

Environment

  • rattler-build: v0.58.4
  • Platform: linux-64
  • Building: noarch Python package with tests section

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions