graal icon indicating copy to clipboard operation
graal copied to clipboard

cannot install scipy with graalpy-23.1.2-macos-aarch64.tar.gz

Open moderncodr opened this issue 1 year ago • 6 comments

hi there,

I tried to install scipy with graalpy 23.1.2 and also tried with 23..1.0, but always got the error: `graalpy -m ginstall install scipy package: 'scipy' not found in known packages, installing with pip

  • /Users/user/Tools/venv/bin/graalpy -m pip install scipy Collecting scipy Using cached scipy-1.10.1.tar.gz (42.4 MB) auto-patching C API usages in /private/var/folders/_b/h77lt7d56q357x80j7g96_bw0000gn/T/pip-install-brymtpoe/scipy_50859947ef7b4f9baa5c121e39a25f6a/scipy/_lib/boost/boost/mpi/python/serialize.hpp auto-patching C API usages in /private/var/folders/_b/h77lt7d56q357x80j7g96_bw0000gn/T/pip-install-brymtpoe/scipy_50859947ef7b4f9baa5c121e39a25f6a/scipy/_lib/boost/boost/mpi/python/skeleton_and_content.hpp auto-patching C API usages in /private/var/folders/_b/h77lt7d56q357x80j7g96_bw0000gn/T/pip-install-brymtpoe/scipy_50859947ef7b4f9baa5c121e39a25f6a/scipy/_lib/boost/boost/python/detail/wrap_python.hpp auto-patching C API usages in /private/var/folders/_b/h77lt7d56q357x80j7g96_bw0000gn/T/pip-install-brymtpoe/scipy_50859947ef7b4f9baa5c121e39a25f6a/scipy/_lib/boost/boost/python/suite/indexing/detail/indexing_suite_detail.hpp Looking for GraalPy patches for scipy Patching package scipy using /Users/honghai/Tools/graalpy-23.1.2-macos-aarch64/lib/graalpy23.1/patches/scipy/scipy-1.10.1.patch patching file meson.build patching file mesonpy_wrapper.py patching file pyproject.toml patching file 'scipy/_lib/_ccallback_c.pyx' patching file 'scipy/_lib/setup.py' patching file 'scipy/_lib/src/messagestream_config.h.in' patching file 'scipy/sparse/linalg/meson.build' patching file 'scipy/special/meson.build' patching file 'tools/cythonize.py' Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [16 lines of output] + meson setup --prefix=/Users/honghai/Tools/graalpy-23.1.2-macos-aarch64 /private/var/folders/_b/h77lt7d56q357x80j7g96_bw0000gn/T/pip-install-brymtpoe/scipy_50859947ef7b4f9baa5c121e39a25f6a /private/var/folders/_b/h77lt7d56q357x80j7g96_bw0000gn/T/pip-install-brymtpoe/scipy_50859947ef7b4f9baa5c121e39a25f6a/mesonbuild-graalpy --native-file=/private/var/folders/_b/h77lt7d56q357x80j7g96_bw0000gn/T/pip-install-brymtpoe/scipy_50859947ef7b4f9baa5c121e39a25f6a/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2 The Meson build system Version: 1.0.0 Source dir: /private/var/folders/_b/h77lt7d56q357x80j7g96_bw0000gn/T/pip-install-brymtpoe/scipy_50859947ef7b4f9baa5c121e39a25f6a Build dir: /private/var/folders/_b/h77lt7d56q357x80j7g96_bw0000gn/T/pip-install-brymtpoe/scipy_50859947ef7b4f9baa5c121e39a25f6a/mesonbuild-graalpy Build type: native build Project name: SciPy Project version: 1.10.1

  ../meson.build:1:0: ERROR: Unable to detect linker for compiler `cc -Wl,--version`
  stdout:
  stderr: ld: unknown options: --version
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  
  
  A full log can be found at /private/var/folders/_b/h77lt7d56q357x80j7g96_bw0000gn/T/pip-install-brymtpoe/scipy_50859947ef7b4f9baa5c121e39a25f6a/mesonbuild-graalpy/meson-logs/meson-log.txt
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.`

I tried to execute cc -Wl,--version

and got the same error: cc -Wl,--version ld: unknown options: --version clang: error: linker command failed with exit code 1 (use -v to see invocation)

but it worked with: cc -Wl --version Apple clang version 15.0.0 (clang-1500.1.0.2.5) Target: arm64-apple-darwin23.2.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

looks like some typo in the code/patch? can anyone help? thanks!

cheers HL

moderncodr avatar Jan 21 '24 21:01 moderncodr

A couple of things.

  1. You should not be using ginstall, just pip install scipy
  2. You are going to need gcc, since SciPy builds only with GFortran which is installed with homebrew's gcc.

If you want a reproducible build, you can fork the graalpython repository and manually execute the github workflow build-macos-aarch64-wheels. In the Github UI for running the workflow, put in "scipy" to only build that and some of its dependencies:

image

I just now started a build of scipy with github actions running on my M1 mac mini

~ % system_profiler SPHardwareDataType
Hardware:

    Hardware Overview:

      Model Name: Mac mini
      Model Identifier: Macmini9,1
      Chip: Apple M1
      Total Number of Cores: 8 (4 performance and 4 efficiency)
      Memory: 16 GB

So you see it's not the fastest Arm mac, and the build took about 15 minutes: https://github.com/timfel/graalpython/actions/runs/7608494191/job/20717803415

timfel avatar Jan 22 '24 09:01 timfel

A couple of things.

1. You should not be using ginstall, just `pip install scipy`

2. You are going to need gcc, since SciPy builds only with GFortran which is installed with homebrew's gcc.

If you want a reproducible build, you can fork the graalpython repository and manually execute the github workflow build-macos-aarch64-wheels. In the Github UI for running the workflow, put in "scipy" to only build that and some of its dependencies:

image

I just now started a build of scipy with github actions running on my M1 mac mini

~ % system_profiler SPHardwareDataType
Hardware:

    Hardware Overview:

      Model Name: Mac mini
      Model Identifier: Macmini9,1
      Chip: Apple M1
      Total Number of Cores: 8 (4 performance and 4 efficiency)
      Memory: 16 GB

So you see it's not the fastest Arm mac, and the build took about 15 minutes: https://github.com/timfel/graalpython/actions/runs/7608494191/job/20717803415

Hi, thanks for your reply! actually I have already tried it with pip, it had the same error. GCC has been installed already, I also tried to install again with homebrew.

still facing the same error. I have M2 chip and macOS 14.2.1. not sure if you need any further information.

cheers

moderncodr avatar Jan 22 '24 18:01 moderncodr

I think this might be

https://github.com/mesonbuild/meson/issues/12419

So it depends on the version of macOS used. Apple rewrote their linker and Meson wants to do a lot of sniffing using flags and the like.

the linker doesn't report 'unknown option:' it reports 'unknown options:' in your case.

Outstanding!

The following command worked for me, albeit it took 50 minutes with a load average of 35 throughout (an Intel mac)

FFLAGS=-fallow-argument-mismatch LDFLAGS='-Wl,-ld_classic' CC=gcc python -m pip install scipy==1.10.1

mikehearn avatar Jan 23 '24 19:01 mikehearn

I think this might be

mesonbuild/meson#12419

So it depends on the version of macOS used. Apple rewrote their linker and Meson wants to do a lot of sniffing using flags and the like.

the linker doesn't report 'unknown option:' it reports 'unknown options:' in your case.

Outstanding!

The following command worked for me, albeit it took 50 minutes with a load average of 35 throughout (an Intel mac)

FFLAGS=-fallow-argument-mismatch LDFLAGS='-Wl,-ld_classic' CC=gcc python -m pip install scipy==1.10.1

Hey Mike, that works!!! thanks a lot! I finally managed to build/install scipy under graalpy. I am facing some issue with installing matplotlib now, but it is different issue, still checking it.

Have a great day ahead! cheers HL

moderncodr avatar Jan 23 '24 22:01 moderncodr

@moderncodr seems like this is resolved, right?

alina-yur avatar Jan 25 '24 11:01 alina-yur

@alina-yur Probably worth keeping it open until installing scipy just works.

mikehearn avatar Feb 01 '24 13:02 mikehearn