Thanks to visit codestin.com
Credit goes to github.com

Skip to content

read_raw_gdf fails with NumPy ≥1.24 (ValueError: The binary mode of fromstring is removed, use frombuffer instead) #13414

@devparikh0506

Description

@devparikh0506

Description of the problem

When trying to load GDF files from the BCI Competition IV dataset using mne.io.read_raw_gdf, the call fails with NumPy ≥1.24 due to deprecated use of np.fromstring in binary mode.

Steps to reproduce

import mne
import numpy as np

print("MNE:", mne.__version__)
print("NumPy:", np.__version__)

raw = mne.io.read_raw_gdf("B0101T.gdf", preload=True)

Link to data

📂 BCI Competition IV Dataset 2b

Download: Official Dataset Link

The dataset comes as a single zip file BCICIV_2b_gdf.zip, which contains multiple .gdf EEG recordings (train/test for all subjects).

Expected results

read_raw_gdf should work with NumPy ≥1.24.
Replacing np.fromstring with np.frombuffer avoids the error.

Actual results

ValueError: The binary mode of fromstring is removed, use frombuffer instead

Traceback points to:

etmode = np.fromstring(etmode, UINT8).tolist()[0]

inside mne/io/edf/edf.py, _read_gdf_header.

Additional information

Platform Windows-11-10.0.26100-SP0
Python 3.13.7 | packaged by Anaconda, Inc. | (main, Sep 9 2025, 19:54:37) [MSC v.1929 64 bit (AMD64)]
Executable c:\Users\devdp\anaconda3\envs\brain_to_action\python.exe
CPU 13th Gen Intel(R) Core(TM) i7-13650HX (20 cores)
Memory 15.7 GiB

Core

  • mne 1.10.1 (latest release)
  • numpy 2.3.3 (unknown linalg bindings (threadpoolctl module not found: No module named 'threadpoolctl'))
  • scipy 1.16.1
  • matplotlib 3.10.6 (backend=module://matplotlib_inline.backend_inline)

Numerical (optional)

  • pandas 2.3.2
  • unavailable sklearn, numba, nibabel, nilearn, dipy, openmeeg, cupy, h5io, h5py

Visualization (optional)

  • unavailable pyvista, pyvistaqt, vtk, qtpy, ipympl, pyqtgraph, mne-qt-browser, ipywidgets, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)

  • unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions