Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on Rocky Linux distro, missing lsb_release #861

Open
2 of 6 tasks
garyo opened this issue May 7, 2024 · 10 comments
Open
2 of 6 tasks

Fails on Rocky Linux distro, missing lsb_release #861

garyo opened this issue May 7, 2024 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@garyo
Copy link

garyo commented May 7, 2024

Description:
The following stanza fails on a CentOS 7 or Rocky Linux 8 Docker image in github, specifically aswf/ci-base:2023:

      - name: Set up python 3.11
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'
          cache: 'pip'

Error log from build action:

Run actions/setup-python@v5
  with:
    python-version: 3.11
    cache: pip
    check-latest: false
    token: ***
    update-environment: true
    allow-prereleases: false
  env:
    BUILDTYPE_LC: release
    OSNAME: ubuntu
    GIT_COMMIT_ID: 641348a
    CONAN_PRESET: conan-release
    BUILD_DIR: build/Release
/usr/bin/docker exec  80999abf9153f55c7bed9a0[2](https://github.com/AcademySoftwareFoundation/openfx/actions/runs/8987538023/job/24686267871#step:6:2)f288fac8b4227[3](https://github.com/AcademySoftwareFoundation/openfx/actions/runs/8987538023/job/24686267871#step:6:3)9f71a56f2ecd135a272c725531 sh -c "cat /etc/*release | grep ^ID"
Installed versions
  Successfully set up CPython (3.11.[9](https://github.com/AcademySoftwareFoundation/openfx/actions/runs/8987538023/job/24686267871#step:6:9))
Error: Unable to locate executable file: lsb_release. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

Action version:
v5

Platform:

  • Ubuntu
  • macOS
  • Windows
  • Rocky Linux, specifically Docker image aswf/ci-base:2023

Runner type:

  • Hosted
  • Self-hosted

Tools version:
3.11

Repro steps:
See above

Expected behavior:
Not to fail; install Python

Actual behavior:
Action fails, see above

@garyo garyo added bug Something isn't working needs triage labels May 7, 2024
@aparnajyothi-y
Copy link

Hello @garyo, Thank you for creating this issue and we will look into it :)

@mahabaleshwars mahabaleshwars self-assigned this May 20, 2024
@Nuru
Copy link

Nuru commented May 23, 2024

I'm having the same problem with v5.1.0 on GitHub hosted ubuntu-22.04

      - uses: actions/setup-python@v5
        with:
          python-version: '3.9'
          cache: 'pip' # caching pip dependencies

Logs:

Run actions/setup-python@v5
  with:
    python-version: 3.9
    cache: pip
    check-latest: false
    token: ***
    update-environment: true
    allow-prereleases: false
/usr/bin/docker exec  e65a6dddc9afaa41c11c7df09f0617fc3082b82b82346802ca21d63e222dd840 sh -c "cat /etc/*release | grep ^ID"
Installed versions
  Successfully set up CPython (3.9.19)
Error: Unable to locate executable file: lsb_release. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

@mahabaleshwars
Copy link

Hello @garyo, would you mind trying to install lsb-release to see if it addresses the problem you're experiencing? Here are the commands for updating the apt package list and installing lsb-release:

- name : Apt-update 
  run: sudo apt-get update
- name: Install lsb-release
  run: sudo apt-get install -y lsb-release

@garyo
Copy link
Author

garyo commented May 24, 2024

It all works fine if that package is installed. It does not work on the image I mentioned (aswf/ci-base:2023) which does not install that by default. Images used for CI builds tend to be quite minimal to save space and speed up startup. Running apt-get update on every run will slow down CI builds. Perhaps if we know what you need from lsb_release there may be an alternative way to determine that on more minimal distros.

@Nuru
Copy link

Nuru commented May 27, 2024

This also happens on Alpine 3.17.3, Debian 11.5-slim, and Red Hat Enterprise Linux 8.9 (Ootpa).

@Nuru
Copy link

Nuru commented May 27, 2024

Apparently this is only a problem when using pip cache:

const osInfo = await getLinuxInfo();

setup-python/src/utils.ts

Lines 169 to 172 in 82c7e63

export async function getLinuxInfo() {
const {stdout} = await exec.getExecOutput('lsb_release', ['-i', '-r', '-s'], {
silent: true
});

@mahabaleshwars
Copy link

Hello @garyo,
In this context, the lsb_release command retrieves the Linux operating system's name and version, facilitating the creation of unique cache keys for Python dependencies. This strategy ensures accurate caching and restoration of dependencies, considering the uniqueness of each combination of the operating system, Python version, and dependency file.

Can you consider using the actions/cache action to cache dependencies and speed up your workflows. In the case of Python, it's often used to cache pip packages. The key for the cache is often generated using the hash of requirements.txt (or other dependency files), and the Python version, not lsb_release. Here is an example:

- name: Cache pip
  uses: actions/cache@v4
  with:
    path: ${{ steps.pip-cache.outputs.dir }}
    key: <primaryKey>   # Replace with the computed primaryKey
    restore-keys: <restoreKey>   # Replace with the computed restoreKey

This will cache pip dependencies and reuse them in subsequent runs, reducing the time it takes to install packages.
For any other inquiries or concerns pertaining to rocky-linux, please get in touch with the rocky-linux team.

@garyo
Copy link
Author

garyo commented Jun 6, 2024

Sure, I understand what lsb_release does. I expect it wouldn't be hard to get the same info in other ways when that is not available, but if you're not interested in that I'll look at other way to setup python on our CI containers.

@pythoninthegrass
Copy link

#890 seems related. Will try using actions/cache@v4 in the interim.

@mahabaleshwars
Copy link

Hello @garyo, we are not planning to alter the usage of lsb_release for cache:pip. The provided solution utilizing actions/cache ensures pip dependencies are cached and reused in subsequent runs, thereby minimizing package installation time.
Please feel free to reach us in case of any concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants