holgern / pyedflib

pyedflib is a python library to read/write EDF+/BDF+ files based on EDFlib.
http://pyedflib.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
209 stars 121 forks source link

Importing fails with NumPy version > 1.24 #251

Closed alexenge closed 3 months ago

alexenge commented 4 months ago

When trying import pyEDFlib with the latest version of NumPy, I'm getting the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[1], line 1
----> 1 import pyedflib

File ~/mambaforge/envs/hu-neuro-pipeline/lib/python3.11/site-packages/pyedflib/__init__.py:19
     16 from . import data
     18 from pyedflib.version import version as __version__
---> 19 from numpy.testing import Tester
     21 __all__ = [s for s in dir() if not s.startswith('_')]
     22 try:
     23     # In Python 2.x the name of the tempvar leaks out of the list
     24     # comprehension.  Delete it to not make it show up in the main namespace.

ImportError: cannot import name 'Tester' from 'numpy.testing' (/Users/alexander/mambaforge/envs/hu-neuro-pipeline/lib/python3.11/site-packages/numpy/testing/__init__.py)

This stack overflow thread suggests that it's due to numpy.testing.Tester only existing up to NumPy version =< 1.24.x; the current version is 1.26.x

Thanks for looking into this :)

skjerns commented 3 months ago

This has already been fixed in https://github.com/holgern/pyedflib/commit/b9f669158c846fc0cdb7b94fb1d2c7d1266afdd4 , please update to the newest version

possibly you need to install with pip and not conda, as conda package upload seems to be broken https://github.com/holgern/pyedflib/issues/250