Skip to content

BUG: meson.build runs gitversion.py with the wrong Python interpreter #24514

Description

@mkoeppe

Describe the issue:

meson.build expects that python in the PATH is a working Python 3; that's not a good assumption.

Given that meson is run via meson_python, the Python in sys.executable should be used instead of leaving it to external circumstances. Note in particular that venvs created by python -m venv have python3 executables but not python executables.

This is on numpy 1.26.0b1 with #24503 as a patch.

I see this on ubuntu-focal, where there's no /usr/bin/python. https://github.com/mkoeppe/sage/actions/runs/5954216252/job/16159923132#step:8:2353

[numpy-1.26.0b1]     The Meson build system
  [numpy-1.26.0b1]     Version: 1.2.99
  [numpy-1.26.0b1]     Source dir: /sage/local/var/lib/sage/venv-python3.11.1/var/tmp/sage/build/numpy-1.26.0b1/src
  [numpy-1.26.0b1]     Build dir: /sage/local/var/lib/sage/venv-python3.11.1/var/tmp/sage/build/numpy-1.26.0b1/src/.mesonpy-q4xlebps/build
  [numpy-1.26.0b1]     Build type: native build
  [numpy-1.26.0b1]   
  [numpy-1.26.0b1]     ../../meson.build:4:11: ERROR: Program or command 'python' not found or not executable
  [numpy-1.26.0b1]   

I also see this on ubuntu-xenial-toolchain-gcc_9, where /usr/bin/python is an unusable Python 2. https://github.com/mkoeppe/sage/actions/runs/5954216252/job/16159922994#step:11:1438

  The Meson build system
  Version: 1.2.99
  Source dir: /sage/local/var/lib/sage/venv-python3.11.1/var/tmp/sage/build/numpy-1.26.0b1/src
  Build dir: /sage/local/var/lib/sage/venv-python3.11.1/var/tmp/sage/build/numpy-1.26.0b1/src/.mesonpy-1mht6y46/build
  Build type: native build

  ../../meson.build:4:11: ERROR: Command `/usr/bin/python numpy/_build_utils/gitversion.py` failed with status 1.

Reproduce the code example:

$ pip install .

Error message:

../../meson.build:4:11: ERROR: Program or command 'python' not found or not executable

Runtime information:

N/A

Context for the issue:

sagemath/sage#36123

Activity

  1. added a commit that references this issue on Aug 24, 2023
    e150c31
  2. rgommers commented on Aug 24, 2023

    @rgommers
    Member

    Thanks for the report @mkoeppe. That's a bug indeed (hopefully the last one). gh-24515 should fix this I believe.

  3. added this to the 1.26.0 release milestone on Aug 24, 2023
  4. mkoeppe commented on Aug 24, 2023

    @mkoeppe
    ContributorAuthor

    I confirm that it works now. Thanks @rgommers!

  5. rgommers commented on Aug 24, 2023

    @rgommers
    Member

    Great, thanks for verifying @mkoeppe

  6. added a commit that references this issue on Aug 24, 2023
    6adf174
  7. added a commit that references this issue on Nov 11, 2023
    eebc7e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions