Skip to content

Conversation

@alexnorell
Copy link
Contributor

@alexnorell alexnorell commented Nov 7, 2025

Problem

Jetson 6.2.0 Docker builds are failing with:

ERROR: GDAL >= 3.5 is required for rasterio. Please upgrade GDAL.
INFO:root:GDAL API version obtained from gdal-config: 3.4.1

Root Cause

  • Jetpack r36.4.0 ships with GDAL 3.4.1
  • rasterio 1.4.x requires GDAL >= 3.5
  • This creates an incompatibility

Solution

Compile GDAL 3.8.5 from source instead of downgrading rasterio.

This provides a forward-compatible solution that:

  • ✅ Meets rasterio 1.4.0's requirements (GDAL >= 3.5)
  • ✅ Keeps packages up to date
  • ✅ Provides better long-term maintainability

Implementation

  • Compile GDAL 3.8.5 in builder stage
  • Install all required GDAL dependencies
  • Copy GDAL libraries, headers, and data to runtime stage
  • Set proper environment variables (GDAL_CONFIG, GDAL_DATA, LD_LIBRARY_PATH)

Testing

Will be tested via GitHub Actions Depot build on merge.

Related

Fixes all recent Jetson 6.2.0 workflow failures on main branch.

Instead of downgrading rasterio, compile GDAL 3.8.5 from source to meet
rasterio 1.4.0's requirement for GDAL >= 3.5.

Changes:
- Compile GDAL 3.8.5 from source in builder stage
- Copy GDAL libraries and data to runtime stage
- Install required GDAL dependencies
- Set GDAL environment variables (GDAL_CONFIG, GDAL_DATA, LD_LIBRARY_PATH)

This provides a forward-compatible solution while maintaining compatibility
with rasterio 1.4.0 and keeping packages up to date.

Jetpack r36.4.0 ships with GDAL 3.4.1, which is incompatible with
rasterio 1.4.x (requires >= 3.5). Building from source solves this.
@alexnorell alexnorell force-pushed the fix/jetson-620-rasterio branch from 9632306 to 18251de Compare November 7, 2025 17:28
@alexnorell alexnorell changed the title Fix Jetson 6.2.0 builds: Downgrade rasterio for GDAL 3.4.1 compatibility Fix Jetson 6.2.0 builds: Compile GDAL 3.8.5 from source for rasterio compatibility Nov 7, 2025
alexnorell and others added 2 commits November 7, 2025 09:33
Runtime stage only needs the runtime libraries to run GDAL, not the
development headers and static libraries. This reduces image size.

Changed from:
- libproj-dev → libproj25
- libsqlite3-dev → libsqlite3-0
- libtiff-dev → libtiff5
- libcurl4-openssl-dev → libcurl4
- etc.

Builder stage keeps -dev packages (needed for compilation).
@alexnorell alexnorell marked this pull request as draft November 7, 2025 17:39
Changed GDAL build from Make to Ninja for faster parallel compilation:
- Added -GNinja to cmake to generate Ninja build files
- Use 'ninja' instead of 'make -j$(nproc)'
- Use 'ninja install' instead of 'make install'

Ninja is faster and more efficient for parallel builds.
ninja-build package is already installed in dependencies.
Updated from 3.8.5 to 3.11.5 (latest as of Nov 4, 2025).

Benefits of 3.11.x:
- Latest bug fixes and security updates
- Improved performance
- New format support
- Still meets rasterio 1.4.0 requirement (GDAL >= 3.5)
Changed libproj25 to libproj22 (correct package name for Ubuntu 22.04 Jammy).

Build was failing with:
E: Unable to locate package libproj25
- Bump pylogix from 1.0.5 to 1.1.3 (latest version)
- Add file package to both builder and runtime stages
- file command is required by Arena API for binary architecture validation

This ensures compatibility with the latest pylogix version and enables proper Arena SDK functionality.
The Dockerfile incorrectly specified torch>=2.8.0 which doesn't exist,
causing pip to fall back to CPU-only PyTorch from PyPI instead of using
the GPU-enabled version from jetson-ai-lab.io.

Changed to torch>=2.0.1,<2.7.0 to match requirements.sam.txt and ensure
GPU-enabled PyTorch is installed from the Jetson AI Lab index.

This fixes the critical bug where the container had no PyTorch GPU support.
This fulfills the TODO in requirements.sam.txt to update to PyTorch 2.8.0
now that pre-built flash-attn is available on jetson-ai-lab.io.

Changes:
- PyTorch: >=2.0.1,<2.7.0 → >=2.8.0
- torchvision: >=0.15.2 → >=0.23.0 (latest)
- Added: flash-attn>=2.8.2 for SAM2 support

This enables full GPU acceleration for SAM2 and other transformer models
with flash attention support on Jetson Orin.
Updated requirements.transformers.txt to match requirements.sam.txt:
- torch: >=2.0.1,<2.7.0 → >=2.8.0
- torchvision: >=0.15.0 → >=0.23.0
- Added: flash-attn>=2.8.2

This resolves the dependency conflict that was causing builds to fail.
…icts

- Remove libgdal-dev from apt-get to prevent conflict with compiled GDAL 3.11.5
- Add GDAL version verification to ensure correct version is available
- Pin flash-attn to 2.8.2 to match pre-built wheel on jetson-ai-lab.io

Fixes GDAL version detection issue where rasterio was finding system GDAL 3.4.1 instead of compiled 3.11.5, and flash-attn build failures when uv tried to compile 2.8.3 from source.
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.

3 participants