I'm trying to speed up my python code, to do so I'm trying to use pypy3. Since scipy is required by the code, I'm trying to reinstall it by doing
pypy3 -mpip install scipy
But this gives me the following error:
AssertionError: would build wheel with unsupported tag ('pp37', 'pypy37_pp73', 'macosx_11_3_x86_64')
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
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
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip
I've already tried to upgrade pip by doing
pip install --upgrade pip
and also
pypy3 -mpip install --upgrade pip
The second actually upgraded it, but didn't fix the issue.
I'm currently on MacOS 12.6 with an M1 chip.
Thanks
If your software uses a lot of scipy and numpy, you will not see a speedup with PyPy since in order to support the cython/c code in those libraries PyPy must use an emulation layer, which can be up to 4x slower than CPython. The answer is for those projects to move to HPy, but that will take a while.
But back to installing scipy on macos PyPy: I would recommend using conda-forge with PyPy3.8 or PyPy3.9 which would allow you to get all of the scientific python stack pre-compiled. They do not yet support the arm64 processor (support for PyPy + arm64 was only released a few weeks ago), but you can run the x86_64 code on your machine.
If you do want to compile from source, PyPy no longer supports python3.7, and the latest release is up to 20% faster, so please try the latest releases. If you still encounter problems, please open an issue