scipy / scipy

SciPy library main repository
https://scipy.org
BSD 3-Clause "New" or "Revised" License
12.98k stars 5.16k forks source link

BUG: unable to install scipy on openBSD on RPi4 #14971

Closed sandeep-gh closed 2 years ago

sandeep-gh commented 2 years ago

Describe your issue.

Using OpenBSD 7.0 on Raspberry 4. Unable to compile/install scipy. The main error I get:

cc1:error: unkown value 'native' for `-march`. 
cc1:note:valid arguments are armv8-a...

Is aarch64/arm64 not a valid arch for scipy? If not, then how to specify that.

Reproducing Code Example

Not applicable

Error message

cc1:error: unkown value 'native' for `-march`. 
cc1:note:valid arguments are armv8-a...


### SciPy/NumPy/Python version information

1.21.3 sys.version_info(major=3, minor=10, micro=0, releaselevel='final', serial=0)
tupui commented 2 years ago

@sandeep-gh we do support arm64/aarch64 we build wheels for these platforms. Have a look at the CI for the wheels there https://github.com/MacPython/scipy-wheels/blob/master/.travis.yml.

How are you installing SciPy? Are you trying to use pip or build from sources? I see Py3.10 and we don't have yet release-wheels #14567.

sandeep-gh commented 2 years ago

I tried both pip and building from source. Both have save errors. I am using Python3.10. I have attached the full compiler/error output. It seems to be picking up either native or wrong march option when compiling. scipyerr.txt

tupui commented 2 years ago

As I said, wheels are not on pip yet. For building from source, seems like you don't have a fortran compiler error: library mach has Fortran sources but no Fortran compiler found

Make sure you are following our guides 😃 http://scipy.github.io/devdocs/dev/contributor/contributor_toc.html#development-environment

sandeep-gh commented 2 years ago

Started all over again with some progress. Installed gcc/gfortran and other python dependencies. The compile command:

 CC=/usr/local/bin/egcc CXX=/usr/local/bin/eg++ gfortran=/usr/local/bin/egfortran FC=/usr/local/bin/egfortran python3 setup.py install

The compile fails with error message:

build/src.openbsd-7.0-arm64-3.10/scipy/integrate/_vodemodule.c:88:10: fatal error: threads.h: No such file or directory
   88 | #include <threads.h>

The above error has been reported for numpy here. For numpy the solution seems to be add

 && !defined(NPY_OS_BSD) \\  

. The NPY_OS_BSD is provided at

https://github.com/numpy/numpy/blob/main/numpy/core/include/numpy/npy_os.h.

Not sure what the corresponding workaround is for scipy.

The compile summary output

########### EXT COMPILER OPTIMIZATION ###########
Platform      : 
  Architecture: aarch64
  Compiler    : gcc

CPU baseline  : 
  Requested   : 'min'
  Enabled     : NEON NEON_FP16 NEON_VFPV4 ASIMD
  Flags       : none
  Extra checks: none

CPU dispatch  : 
  Requested   : 'max -xop -fma4'
  Enabled     : ASIMDHP ASIMDDP
  Generated   : none
CCompilerOpt.cache_flush[809] : write cache to path -> /home/shared/downloads/scipy/build/temp.openbsd-7.0-arm64-3.10/ccompiler_opt_cache_ext.py

########### CLIB COMPILER OPTIMIZATION ###########
Platform      : 
  Architecture: aarch64
  Compiler    : gcc

CPU baseline  : 
  Requested   : 'min'
  Enabled     : NEON NEON_FP16 NEON_VFPV4 ASIMD
  Flags       : none
  Extra checks: none

CPU dispatch  : 
  Requested   : 'max -xop -fma4'
  Enabled     : ASIMDHP ASIMDDP
  Generated   : none
CCompilerOpt.cache_flush[809] : write cache to path -> /home/shared/downloads/scipy/build/temp.openbsd-7.0-arm64-3.10/ccompiler_opt_cache_clib.py
tupui commented 2 years ago

Please have a look at our guides. You're not supposed to do python setup.py install.

rgommers commented 2 years ago

we do support arm64/aarch64 we build wheels for these platforms.

Raspberry Pi is not aarch64, it's 32-bit armv7.

https://www.piwheels.org/ provides SciPy wheels, please use that if you can @sandeep-gh.

The above error has been reported for numpy here.

https://github.com/numpy/numpy/issues/19437 is indeed the problem here. To work around it when building from source (again, only do that if you cannot use https://www.piwheels.org/ wheels), use the same workaround as mentioned for NumPy in that issue. Apply it to the numpy that is used by SciPy at build time. Note that if you build with pip install . instead of python setup.py install, that means using the --no-build-isolation flag for pip install, otherwise there's no way to patch numpy.

sandeep-gh commented 2 years ago

@tupui : In the guide, in "Development environment quickstart guide using pip on Ubuntu Linux"of the development guide, the last paragraph "Buidling Scipy" mentioned that python setup.py build can be used as well. I am using pip install . --no-build-isolation that also works but fails at the threads.h not found error.

sandeep-gh commented 2 years ago

@rgommers I can't use piwheels because I am on openBSD. The --no-build-isolation works. Thanks for that. I guess even though the compiler is reporting fatal error: threads.h : No such file or directory from scipy/integrate/_vodemodule.c, its probably coming from numpy. Will the numpy patch next.

sandeep-gh commented 2 years ago

closing this as the issue is passed the raised concern.

dimpase commented 2 years ago

Raspberry Pi is not aarch64, it's 32-bit armv7.

RPi4 is capable of running a 64-bit OS, it's a 64-bit CPU. It's true that its own RPi OS (a clone of ubunty or debian) is still 32-bit (they have an experimental 64-bit version).

tupui commented 2 years ago

Yes model four is: Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz. Is the 64 bits still in beta? I thought it was now live?