Skip to content

Conversation

@stefwalter
Copy link
Contributor

@stefwalter stefwalter commented Jun 23, 2025

Title:
Fix vulkan container build by using Python 3.11 for ramalama installation

Description:

Summary

Fixes the vulkan container build failure caused by Python version incompatibility.

Problem

The vulkan container build was failing with the error:
ERROR: Package 'ramalama' requires a different Python: 3.9.21 not in '>=3.10'

This occurred because:

  • The current ramalama version requires Python >= 3.10
  • The UBI 9 base image only provides Python 3.9 as the default
  • The build script was attempting to install ramalama using the incompatible Python 3.9

Solution

This PR resolves the issue by:

  • Installing Python 3.11 packages: Added python3.11 and python3.11-pip to the RPM installation list
  • Using Python 3.11 for ramalama: Modified clone_and_build_ramalama() to use python3.11 instead of python3
  • Maintaining compatibility: Kept python3 (3.9) for other pip packages to ensure compatibility with existing scripts
    like rag_framework

Test plan

  • Successfully built vulkan container image
  • Verified all vulkan variants build correctly:
    • quay.io/ramalama/vulkan - Base vulkan image
    • quay.io/ramalama/vulkan-llama-server - Vulkan with LLaMA server
    • quay.io/ramalama/vulkan-whisper-server - Vulkan with Whisper server
    • quay.io/ramalama/vulkan-rag - Vulkan with RAG framework
  • Confirmed rag_framework functionality works with existing Python 3.9

The changes are minimal and focused, addressing the specific Python version compatibility issue while maintaining backward
compatibility.

Summary by Sourcery

Use Python 3.11 in the Vulkan container build to install ramalama properly while retaining Python 3.9 for other components.

Bug Fixes:

  • Resolve build failure by using Python 3.11 for ramalama installation to satisfy its >=3.10 requirement.

Enhancements:

  • Enable debug tracing in the build script with set -x.

Build:

  • Add python3.11 and python3.11-pip to the DNF installation list and switch pip invocation to python3.11 for ramalama.

…tion

The vulkan container build was failing because ramalama now requires Python >= 3.10,
but the UBI 9 base image only provides Python 3.9. This commit resolves the issue by:

- Installing python3.11 and python3.11-pip packages alongside default Python
- Using python3.11 specifically for ramalama installation in clone_and_build_ramalama()
- Keeping python3 (3.9) for other pip packages to maintain compatibility with rag_framework

This allows the vulkan container to build successfully while maintaining backward
compatibility for scripts that expect the default Python version.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 23, 2025

Reviewer's Guide

The PR resolves a Python version incompatibility by installing Python 3.11 alongside existing Python 3.9, switching the ramalama build to use python3.11, and enabling shell tracing to aid debugging.

File-Level Changes

Change Details Files
Enable detailed shell tracing
  • Add 'set -x' after the shebang to print executed commands
container-images/scripts/build_llama_and_whisper.sh
Install Python 3.11 alongside Python 3.9
  • Include 'python3.11' and 'python3.11-pip' in the RPM install list
  • Retain 'python3' for existing dependencies to preserve backward compatibility
container-images/scripts/build_llama_and_whisper.sh
Use Python 3.11 for ramalama installation
  • Update the pip install command in clone_and_build_ramalama() to invoke python3.11 instead of python3
container-images/scripts/build_llama_and_whisper.sh

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @stefwalter, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a build failure for the Vulkan container image by addressing a Python version incompatibility. The core issue was that the ramalama package required Python 3.10 or newer, while the base image provided Python 3.9. My changes introduce Python 3.11 into the build environment and specifically use it for the ramalama installation, ensuring the build completes successfully while preserving compatibility for other Python 3.9-dependent components.

Highlights

  • Build Fix: I've addressed a critical build failure for the Vulkan container image, which was caused by a Python version incompatibility with the ramalama package.
  • Python Version Management: I've updated the build script to install Python 3.11 and its corresponding pip package. This allows ramalama to be installed with its required Python version (>=3.10).
  • Targeted Installation: I've specifically configured the clone_and_build_ramalama function to use python3.11 for installing ramalama, ensuring the correct interpreter is used for this dependency.
  • Backward Compatibility: I've ensured that the default Python 3.9 installation remains available for other components, such as rag_framework, to maintain existing compatibility.
  • Debugging Improvement: I've added set -x to the build script to enable verbose output, which will aid in debugging future build issues by showing executed commands.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @stefwalter - I've reviewed your changes - here's some feedback:

  • Remove the set -x debugging flag once this fix is verified to avoid verbose logging in production builds.
  • You may need to include python3.11-devel in the RPM list to ensure any C extensions build correctly under Python 3.11.
  • Consider parameterizing the target Python version in a variable to simplify future upgrades and avoid hard-coding python3.11.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Remove the `set -x` debugging flag once this fix is verified to avoid verbose logging in production builds.
- You may need to include `python3.11-devel` in the RPM list to ensure any C extensions build correctly under Python 3.11.
- Consider parameterizing the target Python version in a variable to simplify future upgrades and avoid hard-coding `python3.11`.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes a build failure in the Vulkan container by using Python 3.11 for the ramalama installation. The changes include installing Python 3.11, using it for ramalama, and maintaining compatibility with Python 3.9 for other packages. I've suggested adding set -e for improved script robustness.

@@ -1,4 +1,5 @@
#!/bin/bash
set -x
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Consider adding set -e to exit immediately if a command exits with a non-zero status. This can prevent unexpected behavior in automated scripts.[^1]

Alternatively, using set -euxo pipefail is even more robust:

  • -e: exit on error
  • -u: treat unset variables as an error
  • -x: trace command execution
  • -o pipefail: cause a pipeline to return the exit status of the last command in the pipe that returned a non-zero status.
Suggested change
set -x
set -ex

@rhatdan
Copy link
Member

rhatdan commented Jun 23, 2025

Fedora 42 is at 3.13?

Are you doing this just for RHEL9?

@ericcurtin
Copy link
Member

We should stick this in the else part of here, since it's not applicable to Fedora:

    if [ "${ID}" = "fedora" ]; then
      dnf install -y "${rpm_list[@]}"
    else
      dnf_install_epel
      dnf --enablerepo=ubi-9-appstream-rpms install -y "${rpm_list[@]}"
    fi

we did sorta drop ubi9 support to focus on Fedora that's closer to upstream, but we can still take this change.

@stefwalter
Copy link
Contributor Author

stefwalter commented Jun 23, 2025

This was already fixed in main. Was using Claude Code to fix my build. Figured out it was fixed in main when it tried to rebase. Sorry for the noise.

@stefwalter stefwalter closed this Jun 23, 2025
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