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

PyPy 7.3.7 & MacOS 11.x: Numpy fails to build, but only as a build dependency when --use-pep517 is active. #10631

Closed
1 task done
gwerbin opened this issue Nov 3, 2021 · 14 comments
Labels
project: pypy PyPy specific type: bug A confirmed bug or unintended behavior

Comments

@gwerbin
Copy link

gwerbin commented Nov 3, 2021

Description

Under PyPy 7.3.7, Numpy can be built and installed from source with pip install numpy, but it fails to build when being used as a PEP 517 build dependency, with an assertion error about an unsupported tag ('pp37', 'pypy37_pp73', 'macosx_10_7_x86_64').

However, it does appear to work with the --no-use-pep517 flag (at least, it proceeds beyond Numpy and fails anyway because Cython is not available).

Expected behavior

I expected Numpy to work as a PEP 517 build dependency, because it works when I install it as a regular dependency

pip version

pip 21.3.1

Python version

PyPy 7.3.7 (3.7)

OS

MacOS 11.6.1

How to Reproduce

/usr/local/bin/pypy3 --version
# Python 3.7.12 (44db26267d0a38e51a7e8490983ed7e7bcb84b74, Oct 28 2021, 05:11:03)
# [PyPy 7.3.7 with GCC Apple LLVM 13.0.0 (clang-1300.0.29.3)]

/usr/local/bin/pypy3 -m venv ./my-project
./my-project/bin/python -m pip install -U pip setuptools wheel

This works fine:

./my-project/bin/python -m pip install numpy

This does not:

./my-project/bin/python -m pip install -U scipy

But this works fine (until it hits the unrelated Cython error):

./my-project/bin/python -m pip install --no-use-pep517 -U scipy

Output

< ... huge build log and traceback ... >

    AssertionError: would build wheel with unsupported tag ('pp37', 'pypy37_pp73', 'macosx_10_7_x86_64')
    ----------------------------------------
    ERROR: Failed building wheel for numpy
  Failed to build numpy
  ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
  ----------------------------------------

Code of Conduct

@gwerbin gwerbin added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Nov 3, 2021
@pradyunsg
Copy link
Member

/cc @mattip

Could you paste the output of pip debug --verbose into a GitHub Gist, and paste a link to that Gist here?

@pradyunsg pradyunsg added project: pypy PyPy specific S: awaiting response Waiting for a response/more information and removed S: needs triage Issues/PRs that need to be triaged labels Nov 3, 2021
@gwerbin
Copy link
Author

gwerbin commented Nov 3, 2021

@no-response no-response bot removed the S: awaiting response Waiting for a response/more information label Nov 3, 2021
@mattip
Copy link
Contributor

mattip commented Nov 3, 2021

Strange, I see the valid tag pp37-pypy37_pp73-macosx_10_7_x86_64 in the gist. Do things change if you activate the virtualenv instead of running the command from inside it?

/usr/local/bin/pypy3 -m venv ./my-project
source /my-project/bin/activate 

@gwerbin
Copy link
Author

gwerbin commented Nov 3, 2021

Strange, I see the valid tag pp37-pypy37_pp73-macosx_10_7_x86_64 in the gist. Do things change if you activate the virtualenv instead of running the command from inside it?

/usr/local/bin/pypy3 -m venv ./my-project
source /my-project/bin/activate 

Nope, it's the same error when I have the environment activated.

@pradyunsg
Copy link
Member

And finally, can you run the failing command with pip install -v, put that in a Gist and share it?

@gwerbin
Copy link
Author

gwerbin commented Nov 5, 2021

I added the output to my Gist: https://gist.github.com/gwerbin/39c21967f7cd6fad09b95e42e6779b67#file-pip-install

I noticed that this might be a configuration problem in Scipy, not in Pip. The output suggests that it only supports Numpy in the build backend under PyPy 3.8, but not 3.7, so it tries to build a wheel from source and then rejects the wheel for being built with the wrong version. I'm not sure what to make of that. I can try with PyPy 7.3.7 3.8 to see if it works with that version (which is more likely what I'd want to use anyway).

@carlosyanez
Copy link

Hi @gwerbin, have you found a workaround by any chance? I'm having exactly same issue (the same os, python, pypy versions)
Thanks!

@gwerbin
Copy link
Author

gwerbin commented Nov 17, 2021

Hi @gwerbin, have you found a workaround by any chance? I'm having exactly same issue (the same os, python, pypy versions) Thanks!

Unfortunately no, since I was not really using this for any "serious work", so I dropped it. It might be a good idea to raise an issue on the Scipy issue tracker, in case it turns out to be a misconfiguration on their end and not in Pip, which is what I have started to suspect..

@rgommers
Copy link

I noticed that this might be a configuration problem in Scipy, not in Pip. The output suggests that it only supports Numpy in the build backend under PyPy 3.8, but not 3.7

I don't think that is the case. The 1.7.1 and 1.7.2 releases contain:

    # First PyPy versions for which there are numpy wheels
    "numpy==1.20.0; python_version=='3.7' and platform_python_implementation=='PyPy'",

And if you search the Gist linked above for that, it finds it. NumPy has a wheel: numpy-1.20.0-pp37-pypy37_pp73-manylinux2010_x86_64.whl. So it's unclear to me why that is not being picked up.

@rgommers
Copy link

Ah wait, you're on macOS, that is why. So it will build from source, and that just fails (looking now at whether that is expected or not).

@rgommers
Copy link

There is nothing special SciPy is doing here, it's a wheel tag related issue as the original description says. So looks like either a wheel or a pip bug to me - why is this tag unsupported? Is 10_7 too old or some such thing?

      File "/private/var/folders/rb/5pn99y6d2fd373s3nv4_mpv00000gn/T/pip-build-env-hw8in04g/overlay/site-packages/wheel/bdist_wheel.py", line 278, in get_tag
        assert tag in supported_tags, "would build wheel with unsupported tag {}".format(tag)
    AssertionError: would build wheel with unsupported tag ('pp37', 'pypy37_pp73', 'macosx_10_7_x86_64')

@uranusjr
Copy link
Member

uranusjr commented Nov 22, 2021

The tag pp37-pypy37_pp73-macosx_10_7_x86_64 is listed in the previously attached pip debug output, so that tag is fine from pip’s perspective. It’s likely a bug in wheel; the would build wheel with unsupported tag was emitted by it.

@pradyunsg
Copy link
Member

Looks like this got fixed on numpy's end; and there's now a clearer error message in pip for this situation (see #10421) that clearly notes where the issue lies.

@fievelk
Copy link

fievelk commented Feb 20, 2022

Slightly OT. I was having a similar issue, but it was unrelated to the --use-pep517: I couldn't install numpy on macOS 12.2.1 Monterey, not even with a simple pip install numpy.
My configuration:

> python --version
Python 3.8.12 (9ef55f6fc369, Oct 25 2021, 05:10:01)
[PyPy 7.3.7 with GCC Apple LLVM 13.0.0 (clang-1300.0.29.3)]

And the final output error was the same:

Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects

I first ran brew doctor, which showed that my Command Line Tools (XCode) were outdated. Then I just followed the instructions to update them:

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

This solved the issue.

I hope this might help others that get here looking for a solution.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
project: pypy PyPy specific type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

7 participants