meson-python: pip install . --user -> [Errno 2] No such file or directory: 'meson'

Hello,

I am trying to make package build by meson-python installable by pip using pip install --user . (a complete build script, CI config)

Recent changes in pip broke this and mesonpep517 has the same issue https://github.com/jeandet/mesonpep517/issues/1#issuecomment-1148288250

mesonpep517 has opened pull request which is fixing this, however merging takes some time and I simply need this so I tried meson-python.

The result is the same:

...
        File "/tmp/pip-build-env-j8gehd_x/overlay/local/lib/python3.10/dist-packages/mesonpy/__init__.py", line 477, in _meson
          return self._proc('meson', *args)
        File "/tmp/pip-build-env-j8gehd_x/overlay/local/lib/python3.10/dist-packages/mesonpy/__init__.py", line 472, in _proc
          subprocess.check_call(list(args))
        File "/usr/lib/python3.10/subprocess.py", line 364, in check_call
          retcode = call(*popenargs, **kwargs)
        File "/usr/lib/python3.10/subprocess.py", line 345, in call
          with Popen(*popenargs, **kwargs) as p:
        File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: 'meson'

There is a full log from build

The problem is that pip does modify the PATH and meson executable will be missing. Note that this happens only if meson is not installed in the advance. You can fix it by executing meson as a module function and not as an executable, as you are currently doing https://github.com/FFY00/meson-python/blob/main/mesonpy/__init__.py#L477 . (see changes in mesonpep517 pull request). (Note that the user typically does not have meson installed in advance.)

Ubuntu 22.04 LTS

  • python3.10
  • pip-22.0.2
  • meson-0.63.0
  • ninja-1.10.1
  • meson_python-0.7.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 25 (17 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve reported this as https://bugs.debian.org/1019293. I think it’s a bug in one of two Debian packages: either python3.x because the patches to Python that change the installation scheme are doing too much, or python3-pip because it should compensate for those patches when it sets up the PATH.