Skip to content

Commit 5bc2190

Browse files
Mathieu Scheltiennelarsoner
andauthored
Fix _check_edflib_installed (#11996)
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
1 parent ba127f7 commit 5bc2190

File tree

3 files changed

+47
-39
lines changed

3 files changed

+47
-39
lines changed

mne/utils/check.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
from collections.abc import Sequence
88
from difflib import get_close_matches
99
from importlib import import_module
10+
from importlib.metadata import version
1011
import operator
1112
import os
13+
from packaging.version import parse
1214
from pathlib import Path
1315
import re
1416
import numbers
@@ -411,19 +413,18 @@ def _check_eeglabio_installed(strict=True):
411413

412414
def _check_edflib_installed(strict=True):
413415
"""Aux function."""
414-
out = _soft_import("EDFlib", "exporting to EDF", strict=strict) is not None
415-
# EDFlib-Python 1.0.7 not NumPy 2.0 compatible
416-
# https://gitlab.com/Teuniz/EDFlib-Python/-/issues/10
417-
try:
418-
from importlib.metadata import version
419-
416+
out = _soft_import("EDFlib", "exporting to EDF", strict=strict)
417+
if out:
418+
# EDFlib-Python 1.0.7 is not compatible with NumPy 2.0
419+
# https://gitlab.com/Teuniz/EDFlib-Python/-/issues/10
420420
ver = version("EDFlib-Python")
421-
except Exception:
422-
pass
423-
else:
424-
out &= not check_version("numpy", "1.9.9") or _compare_version(
425-
ver, ">", "1.0.7"
426-
)
421+
if parse(ver) <= parse("1.0.7") and parse(np.__version__).major >= 2:
422+
if strict: # pragma: no cover
423+
raise RuntimeError(
424+
f"EDFlib version={ver} is not compatible with NumPy 2.0, consider "
425+
"upgrading EDFlib-Python"
426+
)
427+
out = False
427428
return out
428429

429430

tools/azure_dependencies.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
#!/bin/bash -ef
22

3-
EXTRA_ARGS=""
3+
STD_ARGS="--progress-bar off --upgrade"
44
if [ "${TEST_MODE}" == "pip" ]; then
55
python -m pip install --upgrade pip setuptools wheel
66
python -m pip install --upgrade --only-binary="numba,llvmlite,numpy,scipy,vtk" -r requirements.txt
77
elif [ "${TEST_MODE}" == "pip-pre" ]; then
8-
python -m pip install --progress-bar off --upgrade pip setuptools wheel packaging setuptools_scm
9-
python -m pip install --progress-bar off --upgrade --pre --only-binary ":all:" --extra-index-url "https://www.riverbankcomputing.com/pypi/simple" PyQt6 PyQt6-sip PyQt6-Qt6
8+
STD_ARGS="$STD_ARGS --pre"
9+
python -m pip install $STD_ARGS pip setuptools wheel packaging setuptools_scm
10+
python -m pip install $STD_ARGS --only-binary ":all:" --extra-index-url "https://www.riverbankcomputing.com/pypi/simple" PyQt6 PyQt6-sip PyQt6-Qt6
1011
echo "Numpy etc."
11-
python -m pip install --progress-bar off --upgrade --pre --only-binary ":all:" --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" "numpy>=2.0.0.dev0" scipy statsmodels pandas scikit-learn matplotlib
12+
python -m pip install $STD_ARGS --only-binary ":all:" --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" "numpy>=2.0.0.dev0" scipy statsmodels pandas scikit-learn matplotlib
1213
echo "dipy"
13-
python -m pip install --progress-bar off --upgrade --pre --only-binary ":all:" --extra-index-url "https://pypi.anaconda.org/scipy-wheels-nightly/simple" dipy
14+
python -m pip install $STD_ARGS --only-binary ":all:" --extra-index-url "https://pypi.anaconda.org/scipy-wheels-nightly/simple" dipy
1415
echo "h5py"
15-
python -m pip install --progress-bar off --upgrade --pre --only-binary ":all:" -f "https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com" h5py
16+
python -m pip install $STD_ARGS --only-binary ":all:" -f "https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com" h5py
1617
echo "vtk"
17-
python -m pip install --progress-bar off --upgrade --pre --only-binary ":all:" --extra-index-url "https://wheels.vtk.org" vtk
18+
python -m pip install $STD_ARGS --only-binary ":all:" --extra-index-url "https://wheels.vtk.org" vtk
1819
echo "openmeeg"
19-
python -m pip install --progress-bar off --upgrade --pre --only-binary ":all:" --extra-index-url "https://test.pypi.org/simple" openmeeg
20+
python -m pip install $STD_ARGS --only-binary ":all:" --extra-index-url "https://test.pypi.org/simple" openmeeg
2021
echo "pyvista/pyvistaqt"
2122
python -m pip install --progress-bar off git+https://github.com/pyvista/pyvista
2223
python -m pip install --progress-bar off git+https://github.com/pyvista/pyvistaqt
2324
echo "misc"
24-
python -m pip install --progress-bar off --upgrade --pre imageio-ffmpeg xlrd mffpy python-picard pillow
25+
python -m pip install $STD_ARGS imageio-ffmpeg xlrd mffpy python-picard pillow
2526
echo "nibabel with workaround"
26-
python -m pip install --progress-bar off --upgrade --pre git+https://github.com/mscheltienne/nibabel.git@np.sctypes
27-
EXTRA_ARGS="--pre"
27+
python -m pip install --progress-bar off git+https://github.com/mscheltienne/nibabel.git@np.sctypes
28+
echo "joblib"
29+
python -m pip install --progress-bar off git+https://github.com/joblib/joblib@master
30+
echo "EDFlib-Python"
31+
python -m pip install $STD_ARGS git+https://gitlab.com/Teuniz/EDFlib-Python@master
2832
./tools/check_qt_import.sh PyQt6
2933
else
3034
echo "Unknown run type ${TEST_MODE}"

tools/github_actions_dependencies.sh

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash -ef
22

33
STD_ARGS="--progress-bar off --upgrade"
4-
EXTRA_ARGS=""
54
if [ ! -z "$CONDA_ENV" ]; then
65
echo "Uninstalling MNE for CONDA_ENV=${CONDA_ENV}"
76
conda remove -c conda-forge --force -yq mne
@@ -12,36 +11,40 @@ elif [ ! -z "$CONDA_DEPENDENCIES" ]; then
1211
else
1312
echo "Install pip-pre dependencies"
1413
test "${MNE_CI_KIND}" == "pip-pre"
14+
STD_ARGS="$STD_ARGS --pre"
1515
python -m pip install $STD_ARGS pip setuptools wheel packaging
1616
echo "Numpy"
1717
pip uninstall -yq numpy
1818
echo "PyQt6"
19-
pip install $STD_ARGS --pre --only-binary ":all:" --default-timeout=60 --extra-index-url https://www.riverbankcomputing.com/pypi/simple PyQt6
19+
pip install $STD_ARGS --only-binary ":all:" --default-timeout=60 --extra-index-url https://www.riverbankcomputing.com/pypi/simple PyQt6
2020
echo "NumPy/SciPy/pandas etc."
21-
pip install $STD_ARGS --pre --only-binary ":all:" --default-timeout=60 --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" "numpy>=2.0.0.dev0" scipy scikit-learn pandas matplotlib pillow statsmodels
21+
pip install $STD_ARGS --only-binary ":all:" --default-timeout=60 --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" "numpy>=2.0.0.dev0" scipy scikit-learn pandas matplotlib pillow statsmodels
2222
echo "dipy"
23-
pip install $STD_ARGS --pre --only-binary ":all:" --default-timeout=60 --extra-index-url "https://pypi.anaconda.org/scipy-wheels-nightly/simple" dipy
23+
pip install $STD_ARGS --only-binary ":all:" --default-timeout=60 --extra-index-url "https://pypi.anaconda.org/scipy-wheels-nightly/simple" dipy
2424
echo "H5py"
25-
pip install $STD_ARGS --pre --only-binary ":all:" -f "https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com" h5py
25+
pip install $STD_ARGS --only-binary ":all:" -f "https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com" h5py
2626
echo "OpenMEEG"
27-
pip install $STD_ARGS --pre --only-binary ":all:" --extra-index-url "https://test.pypi.org/simple" openmeeg
27+
pip install $STD_ARGS --only-binary ":all:" --extra-index-url "https://test.pypi.org/simple" openmeeg
2828
# No Numba because it forces an old NumPy version
2929
echo "nilearn and openmeeg"
30-
pip install $STD_ARGS --pre git+https://github.com/nilearn/nilearn
30+
pip install $STD_ARGS git+https://github.com/nilearn/nilearn
3131
echo "VTK"
32-
pip install $STD_ARGS --pre --only-binary ":all:" --extra-index-url "https://wheels.vtk.org" vtk
32+
pip install $STD_ARGS --only-binary ":all:" --extra-index-url "https://wheels.vtk.org" vtk
3333
python -c "import vtk"
3434
echo "PyVista"
35-
pip install --progress-bar off git+https://github.com/pyvista/pyvista
35+
pip install $STD_ARGS git+https://github.com/pyvista/pyvista
3636
echo "pyvistaqt"
37-
pip install --progress-bar off git+https://github.com/pyvista/pyvistaqt
37+
pip install $STD_ARGS git+https://github.com/pyvista/pyvistaqt
3838
echo "imageio-ffmpeg, xlrd, mffpy, python-picard"
39-
pip install --progress-bar off --pre imageio-ffmpeg xlrd mffpy python-picard patsy
39+
pip install $STD_ARGS imageio-ffmpeg xlrd mffpy python-picard patsy
4040
echo "mne-qt-browser"
41-
pip install --progress-bar off git+https://github.com/mne-tools/mne-qt-browser
41+
pip install $STD_ARGS git+https://github.com/mne-tools/mne-qt-browser
4242
echo "nibabel with workaround"
43-
pip install --progress-bar off --pre git+https://github.com/mscheltienne/nibabel.git@np.sctypes
44-
EXTRA_ARGS="--pre"
43+
pip install $STD_ARGS git+https://github.com/mscheltienne/nibabel.git@np.sctypes
44+
echo "joblib"
45+
pip install $STD_ARGS git+https://github.com/joblib/joblib@master
46+
echo "EDFlib-Python"
47+
pip install $STD_ARGS git+https://gitlab.com/Teuniz/EDFlib-Python@master
4548
fi
4649
echo ""
4750

@@ -51,11 +54,11 @@ if [ ! -z "$CONDA_DEPENDENCIES" ]; then
5154
python -m pip install -r requirements_base.txt -r requirements_testing.txt
5255
else
5356
echo "Installing dependencies using pip"
54-
python -m pip install $STD_ARGS $EXTRA_ARGS -r requirements_base.txt -r requirements_testing.txt -r requirements_hdf5.txt
57+
python -m pip install $STD_ARGS -r requirements_base.txt -r requirements_testing.txt -r requirements_hdf5.txt
5558
fi
5659
echo ""
5760

5861
if [ "${DEPS}" != "minimal" ]; then
5962
echo "Installing non-minimal dependencies"
60-
python -m pip install $STD_ARGS $EXTRA_ARGS -r requirements_testing_extra.txt
63+
python -m pip install $STD_ARGS -r requirements_testing_extra.txt
6164
fi

0 commit comments

Comments
 (0)