mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 03:30:05 +02:00
scipy: update to version 1.15.1. (#11783)
Needs fixed lapack package (#11801) merged first. With that, this builds, installs and smoke test (`python3 -c "import scipy; help(scipy)"`) work OK. Previously we where getting missing symbols when attempting scipy builds using meson. Now we instruct the build to use lapack for LAPACK. At least until we decide to just let openblas handle BLAS *and* LAPACK. Solves the issue seen on PR #11536.
This commit is contained in:
@@ -1,131 +0,0 @@
|
||||
From b6e0d70785f85e4a8b9ab61b37f684ad0eca4d28 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksei Gerasimov <aleksei.gerasimov@vutbr.cz>
|
||||
Date: Thu, 15 Oct 2020 14:13:11 +0200
|
||||
Subject: disable ndimage
|
||||
|
||||
|
||||
diff --git a/scipy/setup.py b/scipy/setup.py
|
||||
index 3bcdd48..b3ede6f 100644
|
||||
--- a/scipy/setup.py
|
||||
+++ b/scipy/setup.py
|
||||
@@ -21,7 +21,7 @@ def configuration(parent_package='',top_path=None):
|
||||
config.add_subpackage('spatial')
|
||||
config.add_subpackage('special')
|
||||
config.add_subpackage('stats')
|
||||
- config.add_subpackage('ndimage')
|
||||
+ #config.add_subpackage('ndimage')
|
||||
config.add_subpackage('_build_utils')
|
||||
config.add_subpackage('_lib')
|
||||
config.make_config_py()
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From f9e25e090297e27de3395bab18f104c70358d9ec Mon Sep 17 00:00:00 2001
|
||||
From: begasus <begasus@gmail.com>
|
||||
Date: Mon, 24 May 2021 18:40:26 +0000
|
||||
Subject: Haiku doesn't use -pthread, use -lpthread instead
|
||||
|
||||
|
||||
diff --git a/scipy/fft/_pocketfft/setup.py b/scipy/fft/_pocketfft/setup.py
|
||||
index 7e44565..3b0ead2 100644
|
||||
--- a/scipy/fft/_pocketfft/setup.py
|
||||
+++ b/scipy/fft/_pocketfft/setup.py
|
||||
@@ -15,9 +15,9 @@ def pre_build_hook(build_ext, ext):
|
||||
'int main(int argc, char **argv) {}')
|
||||
if has_pthreads:
|
||||
ext.define_macros.append(('POCKETFFT_PTHREADS', None))
|
||||
- if has_flag(cc, '-pthread'):
|
||||
- args.append('-pthread')
|
||||
- ext.extra_link_args.append('-pthread')
|
||||
+ if has_flag(cc, '-lpthread'):
|
||||
+ args.append('-lpthread')
|
||||
+ ext.extra_link_args.append('-lpthread')
|
||||
else:
|
||||
raise RuntimeError("Build failed: System has pthreads header "
|
||||
"but could not compile with -pthread option")
|
||||
--
|
||||
2.30.2
|
||||
|
||||
From 0450b42c56cb1ed5d80a81447a766a4cfa757e63 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksei Gerasimov <aleksei.gerasimov@vutbr.cz>
|
||||
Date: Tue, 24 Aug 2021 15:19:52 +0200
|
||||
Subject: comment out ndimage import. Only one function (_threshold_mgc_map) is
|
||||
directly affected.
|
||||
|
||||
|
||||
diff --git a/scipy/stats/stats.py b/scipy/stats/stats.py
|
||||
index 2b7dac8..c460637 100644
|
||||
--- a/scipy/stats/stats.py
|
||||
+++ b/scipy/stats/stats.py
|
||||
@@ -172,7 +172,7 @@ import numpy as np
|
||||
from numpy import array, asarray, ma
|
||||
|
||||
from scipy.spatial.distance import cdist
|
||||
-from scipy.ndimage import measurements
|
||||
+#from scipy.ndimage import measurements
|
||||
from scipy._lib._util import (_lazywhere, check_random_state, MapWrapper,
|
||||
rng_integers, float_factorial)
|
||||
import scipy.special as special
|
||||
@@ -5208,32 +5208,33 @@ def _threshold_mgc_map(stat_mgc_map, samp_size):
|
||||
sig_connect : ndarray
|
||||
A binary matrix with 1's indicating the significant region.
|
||||
"""
|
||||
- m, n = stat_mgc_map.shape
|
||||
-
|
||||
- # 0.02 is simply an empirical threshold, this can be set to 0.01 or 0.05
|
||||
- # with varying levels of performance. Threshold is based on a beta
|
||||
- # approximation.
|
||||
- per_sig = 1 - (0.02 / samp_size) # Percentile to consider as significant
|
||||
- threshold = samp_size * (samp_size - 3)/4 - 1/2 # Beta approximation
|
||||
- threshold = distributions.beta.ppf(per_sig, threshold, threshold) * 2 - 1
|
||||
-
|
||||
- # the global scale at is the statistic calculated at maximial nearest
|
||||
- # neighbors. Threshold is the maximium on the global and local scales
|
||||
- threshold = max(threshold, stat_mgc_map[m - 1][n - 1])
|
||||
-
|
||||
- # find the largest connected component of significant correlations
|
||||
- sig_connect = stat_mgc_map > threshold
|
||||
- if np.sum(sig_connect) > 0:
|
||||
- sig_connect, _ = measurements.label(sig_connect)
|
||||
- _, label_counts = np.unique(sig_connect, return_counts=True)
|
||||
-
|
||||
- # skip the first element in label_counts, as it is count(zeros)
|
||||
- max_label = np.argmax(label_counts[1:]) + 1
|
||||
- sig_connect = sig_connect == max_label
|
||||
- else:
|
||||
- sig_connect = np.array([[False]])
|
||||
-
|
||||
- return sig_connect
|
||||
+ raise ImportError("Haiku's package of scipy does not contain ndimage module")
|
||||
+# m, n = stat_mgc_map.shape
|
||||
+#
|
||||
+# # 0.02 is simply an empirical threshold, this can be set to 0.01 or 0.05
|
||||
+# # with varying levels of performance. Threshold is based on a beta
|
||||
+# # approximation.
|
||||
+# per_sig = 1 - (0.02 / samp_size) # Percentile to consider as significant
|
||||
+# threshold = samp_size * (samp_size - 3)/4 - 1/2 # Beta approximation
|
||||
+# threshold = distributions.beta.ppf(per_sig, threshold, threshold) * 2 - 1
|
||||
+#
|
||||
+# # the global scale at is the statistic calculated at maximial nearest
|
||||
+# # neighbors. Threshold is the maximium on the global and local scales
|
||||
+# threshold = max(threshold, stat_mgc_map[m - 1][n - 1])
|
||||
+#
|
||||
+# # find the largest connected component of significant correlations
|
||||
+# sig_connect = stat_mgc_map > threshold
|
||||
+# if np.sum(sig_connect) > 0:
|
||||
+# sig_connect, _ = measurements.label(sig_connect)
|
||||
+# _, label_counts = np.unique(sig_connect, return_counts=True)
|
||||
+#
|
||||
+# # skip the first element in label_counts, as it is count(zeros)
|
||||
+# max_label = np.argmax(label_counts[1:]) + 1
|
||||
+# sig_connect = sig_connect == max_label
|
||||
+# else:
|
||||
+# sig_connect = np.array([[False]])
|
||||
+#
|
||||
+# return sig_connect
|
||||
|
||||
|
||||
def _smooth_mgc_map(sig_connect, stat_mgc_map):
|
||||
--
|
||||
2.30.2
|
||||
119
dev-python/scipy/scipy-1.15.1.recipe
Normal file
119
dev-python/scipy/scipy-1.15.1.recipe
Normal file
@@ -0,0 +1,119 @@
|
||||
SUMMARY="Scientific algorithms library for Python"
|
||||
DESCRIPTION="SciPy is an open source library of scientific tools for Python. \
|
||||
SciPy supplements the popular numpy module, gathering a variety of high level \
|
||||
science and engineering modules together as a single package. SciPy includes \
|
||||
modules for graphics and plotting, optimization, integration, special \
|
||||
functions, signal and image processing, genetic algorithms, ODE solvers, and \
|
||||
others."
|
||||
HOMEPAGE="https://www.scipy.org/"
|
||||
COPYRIGHT=" 2001-2002 Enthought, Inc.
|
||||
2003-2025 SciPy Developers"
|
||||
LICENSE="BSD (3-clause)"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://files.pythonhosted.org/packages/source/s/scipy/scipy-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="033a75ddad1463970c96a88063a1df87ccfddd526437136b6ee81ff0312ebdf6"
|
||||
SOURCE_DIR="scipy-$portVersion"
|
||||
|
||||
ARCHITECTURES="all !x86_gcc2"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
PROVIDES="
|
||||
$portName = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
gcc${secondaryArchSuffix}_syslibs # for libgfortran.so.5 and libstdc++.so.6
|
||||
# lib:libarpack$secondaryArchSuffix # has embedded fallback under scipy/sparse/linalg/eigen/arpack/ARPACK
|
||||
lib:liblapack$secondaryArchSuffix
|
||||
lib:libopenblas$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
# devel:libarpack$secondaryArchSuffix
|
||||
devel:liblapack$secondaryArchSuffix
|
||||
devel:libopenblas$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_PREREQUIRES+="
|
||||
cmd:cython # >=3.0.8,<3.1.0
|
||||
cmd:g++$secondaryArchSuffix
|
||||
cmd:gfortran$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:pkg_config$secondaryArchSuffix
|
||||
# cmd:pythran # optional. >=0.14.0,<0.18.0 (require pythran_$pythonPackage instead?)
|
||||
"
|
||||
|
||||
PYTHON_VERSIONS=(3.10)
|
||||
|
||||
for i in "${!PYTHON_VERSIONS[@]}"; do
|
||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
||||
pythonPackage=python${pythonVersion//.}
|
||||
|
||||
eval "PROVIDES_$pythonPackage=\"
|
||||
${portName}_$pythonPackage = $portVersion
|
||||
\""
|
||||
|
||||
if [ "$targetArchitecture" = x86_gcc2 ]; then
|
||||
eval "PROVIDES_$pythonPackage+=\"
|
||||
scipy_$pythonPackage = $portVersion
|
||||
\""
|
||||
fi
|
||||
|
||||
eval "REQUIRES_$pythonPackage=\"
|
||||
$REQUIRES
|
||||
haiku$secondaryArchSuffix
|
||||
cmd:python$pythonVersion
|
||||
\""
|
||||
|
||||
BUILD_REQUIRES+="
|
||||
build_$pythonPackage
|
||||
installer_$pythonPackage
|
||||
meson_python_$pythonPackage # >=0.15.0,<0.20.0
|
||||
numpy_$pythonPackage
|
||||
pybind11_$pythonPackage # >=2.13.2,<2.14.0
|
||||
"
|
||||
BUILD_PREREQUIRES+="
|
||||
cmd:python$pythonVersion
|
||||
"
|
||||
done
|
||||
|
||||
BUILD()
|
||||
{
|
||||
rm -rf doc/sphinxext/.git
|
||||
|
||||
# Note: ATM, lapack and openblas packages over HaikuPorts are used to provide
|
||||
# LAPACK and BLAS respectively (with BLAS disabled in lapack, and LAPACK disabled
|
||||
# on openblas).
|
||||
# Thus, we need to instruct the build to look for "-Dlapack=lapack" (instead of
|
||||
# expecting it to be in bopenblas).
|
||||
# That might change that in the future, and we could make scipy only rely on openblas.
|
||||
|
||||
for i in "${!PYTHON_VERSIONS[@]}"; do
|
||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
||||
python=python$pythonVersion
|
||||
|
||||
$python -m build --wheel --skip-dependency-check --no-isolation \
|
||||
-Ccompile-args=$jobArgs \
|
||||
-Csetup-args="-Duse-pythran=false" \
|
||||
-Csetup-args="-Dlapack=lapack" \
|
||||
-Cbuilddir="build"
|
||||
# Using a explicit build dir here to stop meson from auto-cleaning it on error.
|
||||
# (this way you can actually access meson-log.txt if needed).
|
||||
done
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
for i in "${!PYTHON_VERSIONS[@]}"; do
|
||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
||||
pythonPackage=python${pythonVersion//.}
|
||||
|
||||
python=python$pythonVersion
|
||||
|
||||
$python -m installer --p $prefix dist/*-$portVersion-*.whl
|
||||
|
||||
packageEntries $pythonPackage \
|
||||
$prefix/lib/python*
|
||||
done
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
SUMMARY="Scientific algorithms library for Python"
|
||||
DESCRIPTION="SciPy is an open source library of scientific tools for Python. \
|
||||
SciPy supplements the popular numpy module, gathering a variety of high level \
|
||||
science and engineering modules together as a single package. SciPy includes \
|
||||
modules for graphics and plotting, optimization, integration, special \
|
||||
functions, signal and image processing, genetic algorithms, ODE solvers, and \
|
||||
others.
|
||||
|
||||
This package does not contain ndimage module."
|
||||
HOMEPAGE="https://www.scipy.org/"
|
||||
COPYRIGHT=" 2001-2002 Enthought, Inc.
|
||||
2003-2021 SciPy Developers"
|
||||
LICENSE="BSD (3-clause)"
|
||||
REVISION="7"
|
||||
SOURCE_URI="https://github.com/scipy/scipy/releases/download/v$portVersion/scipy-$portVersion.tar.xz"
|
||||
CHECKSUM_SHA256="3851fdcb1e6877241c3377aa971c85af0d44f90c57f4dd4e54e1b2bbd742635e"
|
||||
SOURCE_DIR="scipy-$portVersion"
|
||||
PATCHES="scipy-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="all !x86_gcc2"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
PROVIDES="
|
||||
$portName = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
gcc${secondaryArchSuffix}_syslibs
|
||||
numpy$secondaryArchSuffix
|
||||
lib:libblis$secondaryArchSuffix
|
||||
lib:liblapack$secondaryArchSuffix
|
||||
lib:libopenblas$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
devel:libblis$secondaryArchSuffix
|
||||
devel:liblapack$secondaryArchSuffix
|
||||
devel:libopenblas$secondaryArchSuffix
|
||||
"
|
||||
|
||||
PYTHON_VERSIONS=(3.10)
|
||||
|
||||
for i in "${!PYTHON_VERSIONS[@]}"; do
|
||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
||||
pythonPackage=python${pythonVersion//.}
|
||||
|
||||
eval "PROVIDES_$pythonPackage=\"
|
||||
${portName}_$pythonPackage = $portVersion
|
||||
\""
|
||||
|
||||
if [ "$targetArchitecture" = x86_gcc2 ]; then
|
||||
eval "PROVIDES_$pythonPackage+=\"
|
||||
scipy_$pythonPackage = $portVersion
|
||||
\""
|
||||
fi
|
||||
|
||||
eval "REQUIRES_$pythonPackage=\"
|
||||
haiku$secondaryArchSuffix
|
||||
scipy$secondaryArchSuffix == $portVersion base
|
||||
cmd:python$pythonVersion
|
||||
\""
|
||||
|
||||
BUILD_REQUIRES+="
|
||||
pybind11_$pythonPackage
|
||||
numpy_$pythonPackage
|
||||
setuptools_$pythonPackage
|
||||
"
|
||||
BUILD_PREREQUIRES+="
|
||||
cmd:g++$secondaryArchSuffix
|
||||
cmd:gfortran$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:pkg_config$secondaryArchSuffix
|
||||
cmd:python$pythonVersion
|
||||
"
|
||||
done
|
||||
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
# Check at every update in site.cfg.example!
|
||||
cat > site.cfg << EOF
|
||||
[ALL]
|
||||
libraries = execinfo,lapack,openblas
|
||||
library_dirs = /system/$relativeDevelopLibDir
|
||||
include_dirs = /system/$relativeIncludeDir
|
||||
runtime_library_dirs = /system/$relativeLibDir
|
||||
[openblas]
|
||||
libraries = openblas
|
||||
library_dirs = /system/$relativeDevelopLibDir
|
||||
include_dirs = /system/$relativeIncludeDir
|
||||
runtime_library_dirs = /system/$relativeLibDir
|
||||
[blis]
|
||||
libraries = blis
|
||||
library_dirs = /system/$relativeDevelopLibDir
|
||||
include_dirs = /system/$relativeIncludeDir/blis
|
||||
runtime_library_dirs = /system/$relativeLibDir
|
||||
[lapack]
|
||||
library_dirs = /system/$relativeDevelopLibDir
|
||||
include_dirs = /system/$relativeIncludeDir
|
||||
runtime_library_dirs = /system/$relativeLibDir
|
||||
EOF
|
||||
|
||||
rm -rf doc/sphinxext/.git
|
||||
|
||||
for i in "${!PYTHON_VERSIONS[@]}"; do
|
||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
||||
pythonPackage=python${pythonVersion//.}
|
||||
|
||||
python=python$pythonVersion
|
||||
installLocation=$prefix/lib/$python/vendor-packages/
|
||||
export PYTHONPATH=$installLocation:$PYTHONPATH
|
||||
|
||||
mkdir -p $installLocation
|
||||
rm -rf build
|
||||
|
||||
$python setup.py build install \
|
||||
--root=/ --prefix=$prefix
|
||||
|
||||
packageEntries $pythonPackage \
|
||||
$prefix/lib/python*
|
||||
done
|
||||
}
|
||||
Reference in New Issue
Block a user