Skip to content

Commit

Permalink
Revert numpy and scipy
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanking13 committed Jan 13, 2024
1 parent 5a09eef commit 4993736
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 77 deletions.
71 changes: 29 additions & 42 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,52 +42,39 @@ jobs:
which ccache
# - name: Cache conda
# uses: actions/cache@v2
# with:
# path: ~/conda_pkgs_dir
# key:
# ${{ runner.os }}-conda-${{ env.CONDA_CACHE_NUMBER }}-${{
# hashFiles('environment.yml') }}

# - name: Setup Mambaforge
# uses: conda-incubator/setup-miniconda@v2
# with:
# miniforge-variant: Mambaforge
# miniforge-version: latest
# activate-environment: pyodide-env
# use-mamba: true

# - name: Get Date
# id: get-date
# run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
# shell: bash

# - name: Cache Conda env
# id: conda-cache
# uses: actions/cache@v2
# with:
# path: ${{ env.CONDA }}/envs
# key:
# conda-${{ runner.os }}-${{ steps.get-date.outputs.today }}-${{ hashFiles('environment.yml') }}-${{ env.CONDA_CACHE_NUMBER }}

# - name: Update environment if cache miss
# run:
# mamba env update -n pyodide-env -f environment.yml
# if: steps.conda-cache.outputs.cache-hit != 'true'

- uses: actions/setup-python@v5
- name: Cache conda
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CONDA_CACHE_NUMBER }}-${{
hashFiles('environment.yml') }}

- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.11'
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: pyodide-env
use-mamba: true

- uses: actions/setup-node@v4
- name: Get Date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash

- name: Cache Conda env
id: conda-cache
uses: actions/cache@v2
with:
node-version: 20
path: ${{ env.CONDA }}/envs
key:
conda-${{ runner.os }}-${{ steps.get-date.outputs.today }}-${{ hashFiles('environment.yml') }}-${{ env.CONDA_CACHE_NUMBER }}

- name: Install dependencies
shell: bash -l {0}
run: |
sudo apt-get install ccache f2c swig make cmake texinfo autoconf automake libtool wget gfortran build-essential git xxd
- name: Update environment if cache miss
run:
mamba env update -n pyodide-env -f environment.yml
if: steps.conda-cache.outputs.cache-hit != 'true'

- name: Install latest pyodide-build and build dependencies
shell: bash -l {0}
Expand Down
19 changes: 4 additions & 15 deletions packages/numpy/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
package:
name: numpy
version: 1.26.1
version: 1.25.2
tag:
- min-scipy-stack
top-level:
- numpy
source:
url: https://files.pythonhosted.org/packages/78/23/f78fd8311e0f710fe1d065d50b92ce0057fe877b8ed7fd41b28ad6865bfc/numpy-1.26.1.tar.gz
sha256: c8c6c72d4a9f831f328efb1312642a1cafafaa88981d9ab76368d50d07d93cbe
url: https://files.pythonhosted.org/packages/a0/41/8f53eff8e969dd8576ddfb45e7ed315407d27c7518ae49418be8ed532b07/numpy-1.25.2.tar.gz
sha256: fd608e19c8d7c55021dffd43bfe5492fab8cc105cc8986f813f8c3c048b38760

build:
# numpy uses vendored meson, so we need to pass the cross file manually
backend-flags: |
setup-args=-Dallow-noblas=true
setup-args=--cross-file=${MESON_CROSS_FILE}
# numpy creates numpy/distutils/__pycache__ directory during the build.
# It breaks our test because there is a .pyc in the directory.
post: |
cd $WHEELDIR
rm -rf numpy/distutils/__pycache__
backend-flags: --disable-optimization
cflags: |
-Wno-return-type
cross-build-env: true
Expand All @@ -27,9 +19,6 @@ build:
- numpy/core/include/numpy/_numpyconfig.h
- numpy/core/lib/libnpymath.a
- numpy/random/lib/libnpyrandom.a
requirements:
host:
- openblas
about:
home: https://www.numpy.org
PyPI: https://pypi.org/project/numpy
Expand Down
13 changes: 8 additions & 5 deletions packages/scipy/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ source:
- patches/0004-gemm_-no-const.patch
- patches/0005-make-int-return-values.patch
- patches/0006-Rename-_page_trend_test.py-to-prevent-test-unvendori.patch
- patches/0008-Remove-test-modules-that-fails-to-build.patch
- patches/0007-skip-fortran-fails-to-link.patch
- patches/0008-Remove-meson-requirements.patch
- patches/0009-Fix-fitpack.patch
- patches/0010-Fix-gees-calls.patch

Expand All @@ -36,10 +37,7 @@ build:
-I$(WASM_LIBRARY_DIR)/include
-Wno-return-type
-DUNDERSCORE_G77
-fvisibility=default
cxxflags: |
-fexceptions
-fvisibility=default
cxxflags: -fexceptions
ldflags: |
-L$(NUMPY_LIB)/core/lib/
-L$(NUMPY_LIB)/random/lib/
Expand All @@ -51,9 +49,14 @@ build:
# pyodide-build/pyodide_build/_f2c_fixes.py.
script: |
set -x
export PKG_CONFIG_LIBDIR=$WASM_PKG_CONFIG_PATH
export NPY_BLAS_LIBS="-I$WASM_LIBRARY_DIR/include $WASM_LIBRARY_DIR/lib/libopenblas.so"
export NPY_LAPACK_LIBS="-I$WASM_LIBRARY_DIR/include $WASM_LIBRARY_DIR/lib/libopenblas.so"
# setup.py has been renamed to _setup.py in scipy 1.11.2 to discourage its
# usage but we still need it until we manage to build with meson
mv _setup.py setup.py
sed -i 's/recursive //g' scipy/integrate/quadpack/* scipy/interpolate/fitpack/*
sed -i 's/void DQA/int DQA/g' scipy/integrate/__quadpack.h
Expand Down
15 changes: 0 additions & 15 deletions packages/scipy/test_scipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,3 @@ def test_cpp_exceptions(selenium):

with pytest.raises(ValueError):
lombscargle(x=[1], y=[1, 2], freqs=[1, 2, 3])


@pytest.mark.driver_timeout(40)
@run_in_pyodide(packages=["scipy"])
def test_logm(selenium_standalone):
import numpy as np
from numpy import eye, random
from scipy.linalg import logm

random.seed(1234)
dtype = np.float64
n = 2
scale = 1e-4
A = (eye(n) + random.rand(n, n) * scale).astype(dtype)
logm(A)

0 comments on commit 4993736

Please sign in to comment.