Skip to content

Fix CARGO_HOME location for airflow user builds#64899

Merged
potiuk merged 1 commit intoapache:mainfrom
potiuk:fix-home-for-cargo-builds
Apr 8, 2026
Merged

Fix CARGO_HOME location for airflow user builds#64899
potiuk merged 1 commit intoapache:mainfrom
potiuk:fix-home-for-cargo-builds

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented Apr 8, 2026

Move CARGO_HOME from /usr/local/cargo to /home/airflow/.cargo so that
cargo builds work correctly when running as the airflow user, avoiding
permission issues with the system-wide cargo directory.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Claude Opus 4.6)

Generated-by: Claude Code (Claude Opus 4.6) following the guidelines

Move CARGO_HOME from /usr/local/cargo to /home/airflow/.cargo so that
cargo builds work correctly when running as the airflow user, avoiding
permission issues with the system-wide cargo directory.
@boring-cyborg boring-cyborg bot added the area:production-image Production image improvements and fixes label Apr 8, 2026
Copy link
Copy Markdown
Contributor

@ramitkataria ramitkataria left a comment

Choose a reason for hiding this comment

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

Tested this on x86 prod image and can confirm that it now builds successfully. Thanks!

@ramitkataria
Copy link
Copy Markdown
Contributor

This fixes this error which was only occuring in x86 prod image builds:

#55 33.66   ├─▶ The build backend returned an error
#55 33.66   ╰─▶ Call to `maturin.build_wheel` failed (exit status: 1)
#55 33.66 
#55 33.66       [stdout]
#55 33.66       Running `maturin pep517 build-wheel -i
#55 33.66       /tmp/.cache/uv/builds-v0/.tmpYsX87f/bin/python --compatibility off`
#55 33.66 
#55 33.66       [stderr]
#55 33.66           Updating crates.io index
#55 33.66       warning: failed to write cache, path:
#55 33.66       /usr/local/cargo/registry/index/index.crates.io-1949cf8c6b5b557f/.cache/py/o3/pyo3,
#55 33.66       error: Permission denied (os error 13)
#55 33.66        Downloading crates ...
#55 33.66         Downloaded alloc-stdlib v0.2.2
#55 33.66       error: failed to create directory
#55 33.66       `/usr/local/cargo/registry/cache/index.crates.io-1949cf8c6b5b557f`
#55 33.66 
#55 33.66       Caused by:
#55 33.66         Permission denied (os error 13)
#55 33.66       💥 maturin failed
#55 33.66         Caused by: Cargo metadata failed. Does your crate compile with `cargo
#55 33.66       build`?
#55 33.66         Caused by: `cargo metadata` exited with an error:
#55 33.66       Error: command ['maturin', 'pep517', 'build-wheel', '-i',
#55 33.66       '/tmp/.cache/uv/builds-v0/.tmpYsX87f/bin/python', '--compatibility',
#55 33.66       'off'] returned non-zero exit status 1
#55 33.66 
#55 33.66       hint: This usually indicates a problem with the package or the build
#55 33.66       environment.
#55 33.66   help: `pyiceberg-core` (v0.9.0) was included because
#55 33.66         `apache-airflow-providers-common-sql:dev` (v1.34.0) depends on
#55 33.66         `pyiceberg-core`

The root cause of the issue seems to be a missing wheel for pyiceberg-core for x86 in version 0.9.0. This made it build it using cargo which had a permissions issue.

But now, with the new path for CARGO_HOME, that permissions issue during cargo build doesn't occur.

@potiuk potiuk merged commit e62a12d into apache:main Apr 8, 2026
143 checks passed
@potiuk potiuk deleted the fix-home-for-cargo-builds branch April 8, 2026 19:26
potiuk added a commit that referenced this pull request Apr 8, 2026
Move CARGO_HOME from /usr/local/cargo to /home/airflow/.cargo so that
cargo builds work correctly when running as the airflow user, avoiding
permission issues with the system-wide cargo directory.
(cherry picked from commit e62a12d)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
potiuk added a commit that referenced this pull request Apr 8, 2026
…64914)

Move CARGO_HOME from /usr/local/cargo to /home/airflow/.cargo so that
cargo builds work correctly when running as the airflow user, avoiding
permission issues with the system-wide cargo directory.
(cherry picked from commit e62a12d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:production-image Production image improvements and fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants