scipy: BUG: pip install SciPy fails under PyPy

Describe your issue.

I’m seeing this in SymPy CI in https://github.com/sympy/sympy/pull/23859. I don’t immediately have a computer on which I can test this with PyPy locally.

Essentially pip install scipy has failed under PyPy with:

        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/_tags.py", line 79, in __init__
          f'Unknown Python implementation: {self.implementation}. '
      NotImplementedError: Unknown Python implementation: pypy38. Please report this to https://github.com/FFY00/mesonpy/issues and include information about the Python distribution you are using.

You can see the CI setup for this up to the line that fails here: https://github.com/sympy/sympy/blob/7754d037d97d56de9e1bcecb81ecadd4a2e683be/.github/workflows/runtests.yml#L170-L208

The logs for the failed SciPy build are here: https://github.com/sympy/sympy/runs/7583332309?check_suite_focus=true

I have just confirmed that the same CI setup with scipy!=1.9.0 builds 1.8.1 just fine so it seems to be a problem with the 1.9.0 release.

Reproducing Code Example

# Run on Ubuntu 20.04 under PyPy 3.8.
# There might be more to it than this.
# See the CI config above.
pip install scipy

Error message

+ meson install --destdir /tmp/pip-install-pkqrdcy5/scipy_8a1b991ddd494020a114650533cb4ba6/.mesonpy-ve4kjypi/install
      Traceback (most recent call last):
        File "/opt/hostedtoolcache/PyPy/3.8.13/x64/lib/pypy3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
      AttributeError: module 'mesonpy' has no attribute 'prepare_metadata_for_build_wheel'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 714, in _calculate_file_abi_tag_heuristic_posix
          return mesonpy._tags.StableABITag(tag)
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/_tags.py", line 39, in __init__
          raise ValueError(f'Invalid PEP 3149 stable ABI tag, expecting pattern `{self._REGEX.pattern}`')
      ValueError: Invalid PEP 3149 stable ABI tag, expecting pattern `^abi(?P<abi_number>[0-9]+)$`
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/opt/hostedtoolcache/PyPy/3.8.13/x64/lib/pypy3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/opt/hostedtoolcache/PyPy/3.8.13/x64/lib/pypy3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/opt/hostedtoolcache/PyPy/3.8.13/x64/lib/pypy3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 927, in build_wheel
          return project.wheel(out).name
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 875, in wheel
          wheel = _WheelBuilder(self).build(self._install_plan, self._copy_files, self._build_dir)
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 356, in build
          wheel_file = pathlib.Path(directory, f'{self.name}.whl')
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 165, in name
          python_tag=self._project.python_tag,
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 657, in python_tag
          selected_tag = self._select_abi_tag()
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 779, in _select_abi_tag
          tags = self._files_by_tag()
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 759, in _files_by_tag
          tag = self._calculate_file_abi_tag_heuristic(file)
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 723, in _calculate_file_abi_tag_heuristic
          return self._calculate_file_abi_tag_heuristic_posix(filename)
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/__init__.py", line 716, in _calculate_file_abi_tag_heuristic_posix
          return mesonpy._tags.LinuxInterpreterTag(tag)
        File "/tmp/pip-build-env-mupbdlja/overlay/lib/pypy3.8/site-packages/mesonpy/_tags.py", line 79, in __init__
          f'Unknown Python implementation: {self.implementation}. '
      NotImplementedError: Unknown Python implementation: pypy38. Please report this to https://github.com/FFY00/mesonpy/issues and include information about the Python distribution you are using.

SciPy/NumPy/Python version information

SciPy 1.9.0, PyPy 3.8

About this issue

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

Commits related to this issue

Most upvoted comments

I can confirm that with the latest release of PyPy (7.3.11) this is now fixed as tested in this PR: https://github.com/sympy/sympy/pull/24393.

Also thanks to all from SciPy and PyPy for fixing!

See https://foss.heptapod.net/pypy/pypy/-/issues/3870. This was fixed on PyPy HEAD.

I don’t know what causes it but something should really be done about the error message:

     AttributeError: module 'mesonpy' has no attribute 'prepare_metadata_for_build_wheel'

Failure should be reported in some other way than AttributeError.

@snydej can you please open a new issue with the full traceback you are seeing, and Cc me on the issue?

AttributeError: module ‘mesonpy’ has no attribute ‘prepare_metadata_for_build_wheel’

This is a generic message that will be visible for all build failures, the actual problem will be higher up.

The problem reported in this bug reported (NotImplementedError: Unknown Python implementation: pypy38) was fixed. Maybe there’s another issue on your system, or with PyPy in general.