pyodide/packages/scipy/meta.yaml

145 lines
5.4 KiB
YAML
Raw Normal View History

2018-07-18 13:32:16 +00:00
package:
name: scipy
Use pypa/build (#2272) This resolves #2189. > build isolation would be a bit difficult to use in our case, as for instance > when building scipy we need the patched numpy on the host and not the numpy > version specified in pyproject.toml (which would be unpatched) This is indeed the case, certain packages cannot be isolated. My strategy is to make a list of packages that shouldn't be isolated and add symlinks from the isolated build environment into the `.artifacts` directory to "unisolate" them. Then we remove the unisolated package requirements from the list of packages to install, in case pesky constraints aren't satisfied. In particular, packages that expect to be used with `pypa/build` often feel free to put very specific constraints on their build dependencies (often asking them to be == to a particular version). Specific version constraints is good for build reproducibility and with build isolation doesn't cost anything. So we just ignore the constraints. Hopefully nothing goes wrong. In particular, any package that does stuff both at build time and at runtime and requires synchronization between the build time and run time environments needs the unisolation. This includes cffi with `_cffi_backend.so`, and of course numpy and scipy. pycparser needs to be unisolated because it is a dependency of cffi. Currently I have also unisolated pythran and cython, though these are build time only tools and do not really need to be unisolated. Cython I unisolated specifically because numcodecs needs it but it isn't in the numcodecs build dependencies. Pythran I unisolated because of a problem with the scipy build which I don't fully understand (some problem with long double feature detection).
2022-03-22 05:05:30 +00:00
version: 1.7.3
2022-01-03 22:07:13 +00:00
# See extra explanation in info.md
#
# For future reference: if you see the following errors:
# Declaration error: adjustable dimension on non-argument
# or:
# nonconstant array size
# you are trying to compile code that isn't written to the fortran 77 standard.
# The line number in the error points to the last line of the problematic
# subroutine. Try deleting it.
2018-07-18 13:32:16 +00:00
source:
2022-01-03 22:07:13 +00:00
url: https://files.pythonhosted.org/packages/61/67/1a654b96309c991762ee9bc39c363fc618076b155fe52d295211cf2536c7/scipy-1.7.3.tar.gz
sha256: ab5875facfdef77e0a47d5fd39ea178b58e60e454a4c85aa1e52fcb80db7babf
2018-10-05 13:26:21 +00:00
patches:
2022-01-03 22:07:13 +00:00
- patches/add-lapack_extras-to-flapack.patch
- patches/convert-xerrwv-message-arg-from-int-to-str.patch
- patches/disable-blas-detection.patch
- patches/fix-fortran-files-minpack.patch
- patches/gemm_-no-const.patch
- patches/make-int-return-values.patch
2022-01-03 22:07:13 +00:00
- patches/remove-cuncsd-dorcsd-sorcsd-zuncsd.patch
- patches/remove-mvnun-not-fortran-77-compliant.patch
- patches/sasum-returns-double-not-float.patch
- patches/skip-fortran-fails-to-link.patch
- patches/rename-_page_trend_test.patch
2022-01-16 20:30:42 +00:00
- patches/USE_CPP14-branch-doesn-t-work-for-wasm.patch
- patches/0001-Fix-getbreak-dlamch.patch
- patches/0001-Fix-dstevr-in-special-lapack_defs.h.patch
2022-04-06 15:12:06 +00:00
- patches/0001-loadDynamicLibrary-flapack.patch
2018-07-18 13:32:16 +00:00
build:
cflags: |
-I$(PYODIDE_ROOT)/packages/CLAPACK/build/CLAPACK-3.2.1/INCLUDE
Use pypa/build (#2272) This resolves #2189. > build isolation would be a bit difficult to use in our case, as for instance > when building scipy we need the patched numpy on the host and not the numpy > version specified in pyproject.toml (which would be unpatched) This is indeed the case, certain packages cannot be isolated. My strategy is to make a list of packages that shouldn't be isolated and add symlinks from the isolated build environment into the `.artifacts` directory to "unisolate" them. Then we remove the unisolated package requirements from the list of packages to install, in case pesky constraints aren't satisfied. In particular, packages that expect to be used with `pypa/build` often feel free to put very specific constraints on their build dependencies (often asking them to be == to a particular version). Specific version constraints is good for build reproducibility and with build isolation doesn't cost anything. So we just ignore the constraints. Hopefully nothing goes wrong. In particular, any package that does stuff both at build time and at runtime and requires synchronization between the build time and run time environments needs the unisolation. This includes cffi with `_cffi_backend.so`, and of course numpy and scipy. pycparser needs to be unisolated because it is a dependency of cffi. Currently I have also unisolated pythran and cython, though these are build time only tools and do not really need to be unisolated. Cython I unisolated specifically because numcodecs needs it but it isn't in the numcodecs build dependencies. Pythran I unisolated because of a problem with the scipy build which I don't fully understand (some problem with long double feature detection).
2022-03-22 05:05:30 +00:00
-I$(HOSTSITEPACKAGES)/pythran/
2022-01-03 22:07:13 +00:00
-Wno-return-type
-DUNDERSCORE_G77
ldflags: |
-L$(NUMPY_LIB)
2022-01-03 22:07:13 +00:00
# IMPORTANT: Other locations important in scipy build process:
# There are two files built in the "capture" pass that need patching:
# _blas_subroutines.h, and _cython
# Scipy has a bunch of custom logic implemented in
# pyodide-build/pyodide_build/_f2c_fixes.py.
script: |
Use pypa/build (#2272) This resolves #2189. > build isolation would be a bit difficult to use in our case, as for instance > when building scipy we need the patched numpy on the host and not the numpy > version specified in pyproject.toml (which would be unpatched) This is indeed the case, certain packages cannot be isolated. My strategy is to make a list of packages that shouldn't be isolated and add symlinks from the isolated build environment into the `.artifacts` directory to "unisolate" them. Then we remove the unisolated package requirements from the list of packages to install, in case pesky constraints aren't satisfied. In particular, packages that expect to be used with `pypa/build` often feel free to put very specific constraints on their build dependencies (often asking them to be == to a particular version). Specific version constraints is good for build reproducibility and with build isolation doesn't cost anything. So we just ignore the constraints. Hopefully nothing goes wrong. In particular, any package that does stuff both at build time and at runtime and requires synchronization between the build time and run time environments needs the unisolation. This includes cffi with `_cffi_backend.so`, and of course numpy and scipy. pycparser needs to be unisolated because it is a dependency of cffi. Currently I have also unisolated pythran and cython, though these are build time only tools and do not really need to be unisolated. Cython I unisolated specifically because numcodecs needs it but it isn't in the numcodecs build dependencies. Pythran I unisolated because of a problem with the scipy build which I don't fully understand (some problem with long double feature detection).
2022-03-22 05:05:30 +00:00
pip install -t $HOSTSITEPACKAGES pythran scipy==$PKG_VERSION
2022-01-03 22:07:13 +00:00
# We get linker errors because the following 36 functions are missing
# Copying them from a more recent LAPACK seems to work fine.
wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.0.tar.gz
tar xzf v3.10.0.tar.gz
cd lapack-3.10.0/SRC
cat \
cgemqrt.f cgeqrfp.f cgeqrt.f clahqr.f csyconv.f csyconvf.f csyconvf_rook.f ctpmqrt.f ctpqrt.f \
dgemqrt.f dgeqrfp.f dgeqrt.f dlahqr.f dsyconv.f dsyconvf.f dsyconvf_rook.f dtpmqrt.f dtpqrt.f \
sgemqrt.f sgeqrfp.f sgeqrt.f slahqr.f ssyconv.f ssyconvf.f ssyconvf_rook.f stpmqrt.f stpqrt.f \
zgemqrt.f zgeqrfp.f zgeqrt.f zlahqr.f zsyconv.f zsyconvf.f zsyconvf_rook.f ztpmqrt.f ztpqrt.f \
>> ../../scipy/linalg/lapack_extras.f
sed -i 's/CHARACTER/INTEGER/g' ../../scipy/linalg/lapack_extras.f
2022-01-03 22:07:13 +00:00
cd ../..
# The additional four functions cuncsd, dorcsd, sorcsd, and zuncsd are also
# missing but they use features of Fortran that aren't Fortran 77 compatible
# so f2c can't handle them. We stub them with C definitions that do nothing.
# These stubs come from f2cpatches/wrap_dummy_g77_abi.patch
# Change many functions that return void into functions that return int
find scipy -name "*.c*" | xargs sed -i 's/extern void F_FUNC/extern int F_FUNC/g'
sed -i 's/void F_FUNC/int F_FUNC/g' scipy/odr/__odrpack.c
sed -i 's/^void/int/g' scipy/odr/odrpack.h
sed -i 's/^void/int/g' scipy/odr/__odrpack.c
sed -i 's/void BLAS_FUNC/int BLAS_FUNC/g' scipy/special/lapack_defs.h
# sed -i 's/void F_FUNC/int F_FUNC/g' scipy/linalg/_lapack_subroutines.h
2022-01-03 22:07:13 +00:00
sed -i 's/extern void/extern int/g' scipy/optimize/__minpack.h
sed -i 's/void/int/g' scipy/linalg/cython_blas_signatures.txt
sed -i 's/^void/int/g' scipy/interpolate/src/_fitpackmodule.c
sed -i 's/^void/int/g' scipy/optimize/_trlib/trlib_private.h
sed -i 's/^void/int/g' scipy/optimize/_trlib/trlib/trlib_private.h
sed -i 's/, int)/)/g' scipy/optimize/_trlib/trlib_private.h
sed -i 's/, 1)/)/g' scipy/optimize/_trlib/trlib_private.h
sed -i 's/^void/int/g' scipy/spatial/qhull_misc.h
sed -i 's/, size_t)/)/g' scipy/spatial/qhull_misc.h
sed -i 's/,1)/)/g' scipy/spatial/qhull_misc.h
2022-01-03 22:07:13 +00:00
# Missing declaration from cython_lapack_signatures.txt
echo "void ilaenv(int *ispec, char *name, char *opts, int *n1, int *n2, int *n3, int *n4)" \
>> scipy/linalg/cython_lapack_signatures.txt
# sed -i 's/^void/int/g' scipy/linalg/cython_lapack_signatures.txt
2022-01-03 22:07:13 +00:00
# Input error causes "duplicate symbol" linker errors. Empty out the file.
echo "" > scipy/sparse/linalg/dsolve/SuperLU/SRC/input_error.c
2018-07-18 13:32:16 +00:00
requirements:
run:
- numpy
- CLAPACK
2018-10-30 12:10:10 +00:00
test:
imports:
- scipy
2018-10-31 14:06:08 +00:00
- scipy.cluster
2022-01-03 22:07:13 +00:00
- scipy.cluster.vq
- scipy.cluster.hierarchy
2018-10-31 14:06:08 +00:00
- scipy.constants
2022-01-03 22:07:13 +00:00
- scipy.fft
2018-10-31 14:06:08 +00:00
- scipy.fftpack
- scipy.integrate
2022-01-03 22:07:13 +00:00
- scipy.interpolate
- scipy.io
- scipy.io.arff
- scipy.io.matlab
- scipy.io.wavfile
2018-10-30 12:10:10 +00:00
- scipy.linalg
2022-01-03 22:07:13 +00:00
- scipy.linalg.blas
- scipy.linalg.cython_blas
- scipy.linalg.lapack
- scipy.linalg.cython_lapack
- scipy.linalg.interpolative
2018-10-31 14:06:08 +00:00
- scipy.misc
- scipy.ndimage
2022-01-03 22:07:13 +00:00
- scipy.odr
- scipy.optimize
- scipy.signal
- scipy.signal.windows
- scipy.sparse
- scipy.sparse.linalg
- scipy.sparse.csgraph
2018-10-31 14:06:08 +00:00
- scipy.spatial
2022-01-03 22:07:13 +00:00
- scipy.spatial.distance
- scipy.spatial.transform
2018-10-30 12:10:10 +00:00
- scipy.special
2022-01-03 22:07:13 +00:00
- scipy.stats
- scipy.stats.contingency
- scipy.stats.distributions
- scipy.stats.mstats
- scipy.stats.qmc