Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] - numpy.frombuffer buffer size error #403

Open
lpjiang97 opened this issue Mar 1, 2025 · 0 comments
Open

[Bug report] - numpy.frombuffer buffer size error #403

lpjiang97 opened this issue Mar 1, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@lpjiang97
Copy link

I did a fresh install of iblenv on a M2 MacBook running MacOS 15.3 but got an error when loading spikes:

from one.api import ONE
from brainbox.io.one import SpikeSortingLoader

one = ONE(
    base_url='https://openalyx.internationalbrainlab.org',
    password='international',
    silent=True,
)
eid = 'caa5dddc-9290-4e27-9f5e-575ba3598614'
pids, probes = one.eid2pid(eid)
loader = SpikeSortingLoader(one=one, pid=pids[0], eid=eid)

The code above produced the following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[5], line 1
----> 1 loader = SpikeSortingLoader(one=one, pid=pids[0], eid=eid)

File <string>:18, in __init__(self, one, atlas, pid, eid, pname, session_path, collections, datasets, files, raw_data_files, collection, histology, spike_sorter, spike_sorting_path, _sync)

File ~/.miniconda3/envs/iblenv/lib/python3.10/site-packages/brainbox/io/one.py:839, in SpikeSortingLoader.__post_init__(self)
    837 self.datasets = self.one.list_datasets(self.eid)
    838 if self.atlas is None:
--> 839     self.atlas = AllenAtlas()
    840 self.files = {}
    841 self.raw_data_files = []

File ~/.miniconda3/envs/iblenv/lib/python3.10/site-packages/iblatlas/atlas.py:1388, in AllenAtlas.__init__(self, res_um, scaling, mock, hist_path)
   1386     # loads the files
   1387     label = self._read_volume(file_label_remap)
-> 1388     image = self._read_volume(hist_path)
   1390 super().__init__(image, label, dxyz, regions, ibregma, dims2xyz=dims2xyz, xyz2dims=xyz2dims)

File ~/.miniconda3/envs/iblenv/lib/python3.10/site-packages/iblatlas/atlas.py:1395, in AllenAtlas._read_volume(file_volume)
   1392 @staticmethod
   1393 def _read_volume(file_volume):
   1394     if file_volume.suffix == '.nrrd':
-> 1395         volume, _ = nrrd.read(file_volume, index_order='C')  # ml, dv, ap
   1396         # we want the coronal slice to be the most contiguous
   1397         volume = np.transpose(volume, (2, 0, 1))  # image[iap, iml, idv]

File ~/.miniconda3/envs/iblenv/lib/python3.10/site-packages/nrrd/reader.py:526, in read(filename, custom_field_map, index_order)
    524 with open(filename, 'rb') as fh:
    525     header = read_header(fh, custom_field_map)
--> 526     data = read_data(header, fh, filename, index_order)
    528 return data, header

File ~/.miniconda3/envs/iblenv/lib/python3.10/site-packages/nrrd/reader.py:465, in read_data(header, fh, filename, index_order)
    461     del compressed_data
    463     # Byte skip is applied AFTER the decompression. Skip first x bytes of the decompressed data and parse it using
    464     # NumPy
--> 465     data = np.frombuffer(decompressed_data[byte_skip:], dtype)
    467 # Close the file if we opened it
    468 if data_filename is not None:

ValueError: buffer size must be a multiple of element size

To Reproduce

  1. A fresh install of iblenv
  2. Run the code snippet above

Expected behavior
A spike loader created without errors.

Hardware info

  • Apple M2 Max
  • OS: MacOS 15.3

pip freeze outputs

alabaster==1.0.0
anyio==4.8.0
appdirs==1.4.4
appnope==0.1.4
apptools==5.3.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.4
attrs==25.1.0
babel==2.17.0
beautifulsoup4==4.13.3
bleach==6.2.0
blinker==1.9.0
boto3==1.37.4
botocore==1.37.4
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
click==8.1.8
cloudpickle==3.1.1
colorcet==3.1.0
colorlog==6.9.0
comm==0.2.2
contourpy==1.3.1
cryptography==44.0.1
cycler==0.12.1
Cython==3.0.12
dask==2025.2.0
dataclasses==0.6
datajoint==0.14.3
debugpy==1.8.12
decorator==5.2.1
defusedxml==0.7.1
docutils==0.21.2
easyqc==1.0.0
exceptiongroup==1.2.2
executing==2.2.0
Faker==36.1.1
fastjsonschema==2.21.1
figrid==0.1.7
flake8==7.1.2
Flask==3.1.0
fonttools==4.56.0
fqdn==1.5.1
fsspec==2025.2.0
globus-sdk==3.50.0
graphviz==0.20.3
h11==0.14.0
h5py==3.13.0
httpcore==1.0.7
httpx==0.28.1
ibl-neuropixel==1.6.2
ibl-style==0.1.0
-e git+https://github.com/int-brain-lab/iblapps@3bc02a225ad26faa44f4be3b0fa0fa3ab2d6ad27#egg=iblapps
iblatlas==0.5.6
ibllib==3.2.0
iblqt==0.4.2
iblutil==1.14.0
idna==3.10
imagecodecs==2024.12.30
imageio==2.37.0
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.0.0
ipykernel==6.29.5
ipython==8.33.0
ipywidgets==8.1.5
isoduration==20.11.0
itsdangerous==2.2.0
jedi==0.19.2
Jinja2==3.1.5
jmespath==1.0.1
joblib==1.4.2
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter==1.1.1
jupyter-console==6.6.3
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyterlab==4.3.5
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.13
kiwisolver==1.4.8
lazy_loader==0.4
llvmlite==0.44.0
locket==1.0.0
MarkupSafe==3.0.2
matplotlib==3.10.1
matplotlib-inline==0.1.7
mccabe==0.7.0
minio==7.2.15
mistune==3.1.2
mtscomp==1.0.2
narwhals==1.28.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
networkx==3.4.2
notebook==7.3.2
notebook_shim==0.2.4
npTDMS==1.10.0
numba==0.61.0
numpy==1.26.4
ONE-api==3.0.0
opencv-python==4.11.0.86
opencv-python-headless==4.11.0.86
otumat==0.3.1
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
partd==1.4.2
patsy==1.0.1
pexpect==4.9.0
phylib==2.6.0
pillow==11.1.0
platformdirs==4.3.6
plotly==6.0.0
pluggy==1.5.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
psutil==7.0.0
Psychofit==1.0.0.post0
ptyprocess==0.7.0
pure_eval==0.2.3
pyarrow==19.0.1
pycodestyle==2.12.1
pycparser==2.22
pycryptodome==3.21.0
pydot==3.0.4
pyerf==1.0.1
pyflakes==3.2.0
Pygments==2.19.1
PyJWT==2.10.1
PyMySQL==1.1.1
pynrrd==1.1.3
PyOpenGL==3.1.9
pyparsing==3.2.1
PyQt5==5.15.11
PyQt5-Qt5==5.15.16
PyQt5_sip==12.17.0
pyqtgraph==0.13.7
pytest==8.3.4
python-dateutil==2.9.0.post0
python-json-logger==3.2.1
pytz==2025.1
PyYAML==6.0.2
pyzmq==26.2.1
QtPy==2.4.3
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.23.1
ruff==0.9.9
s3transfer==0.11.3
scikit-image==0.25.2
scikit-learn==1.6.1
scikits.bootstrap==1.1.0
scipy==1.15.2
seaborn==0.13.2
Send2Trash==1.8.3
SimpleITK==2.4.1
six==1.17.0
slidingRP==1.1.1
sniffio==1.3.1
snowballstemmer==2.2.0
soundfile==0.13.1
soupsieve==2.6
sparse==0.15.5
Sphinx==8.1.3
sphinx-gallery==0.19.0
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
statsmodels==0.14.4
terminado==0.18.1
threadpoolctl==3.5.0
tifffile==2025.2.18
tinycss2==1.4.0
tomli==2.2.1
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traits==7.0.2
types-python-dateutil==2.9.0.20241206
typing_extensions==4.12.2
tzdata==2025.1
uri-template==1.3.0
urllib3==2.3.0
watchdog==6.0.0
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
Werkzeug==3.1.3
widgetsnbextension==4.0.13
zipp==3.21.0
@lpjiang97 lpjiang97 added the bug Something isn't working label Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant