NeurodataWithoutBorders / pynwb

A Python API for working with Neurodata stored in the NWB Format
https://pynwb.readthedocs.io
Other
178 stars 84 forks source link

[Bug]: Displaying nwb crashes kernel #1913

Closed rcpeene closed 4 months ago

rcpeene commented 4 months ago

What happened?

I attempt to display an nwb file in a Jupyter notebook by simply listing the nwb to be evaluated as cell output like so nwb But this causes the kernel to crash and the nwb is not displayed.

This problem has been reported by other users of the openscope databook

Steps to Reproduce

I'm running the following notebook
https://alleninstitute.github.io/openscope_databook/basics/stream_nwb.html

except the very last line of the last cell is replaced with `nwb` rather than `print(nwb)`.
I also receive this problem in notebooks that are not streaming nwb files and are opening them locally.

Traceback

Cannot execute code, session has been disposed. Please try restarting the Kernel.
The Kernel crashed while executing code in the the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click here for more info. View Jupyter log for further details.


### Operating System

Windows

### Python Executable

Python

### Python Version

3.10

### Package Versions

accessible-pygments==0.0.5
aiobotocore==2.13.0
aiohttp==3.9.5
aioitertools==0.11.0
aiosignal==1.3.1
alabaster==0.7.16
annotated-types==0.7.0
anyio==4.3.0
appdirs==1.4.4
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
argschema==2.0.2
arrow==1.3.0
asciitree==0.3.3
asttokens==2.4.1
async-lru==2.0.4
async-timeout==4.0.3
attrs==23.2.0
autograd==1.6.2
Babel==2.15.0
backports.tarfile==1.1.1
bcrypt==4.1.3
beautifulsoup4==4.12.3
bidsschematools==0.7.2
bleach==6.1.0
botocore==1.34.106
bqplot==0.12.43
ccfwidget==0.5.3
cebra==0.4.0
cellpose==3.0.8
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
ci-info==0.3.0
click==8.1.7
click-didyoumean==0.3.1
cloudpickle==3.0.0
colorama==0.4.6
colorcet==3.1.0
comm==0.2.2
contourpy==1.2.1
coverage==7.5.1
cryptography==42.0.7
cycler==0.12.1
Cython==3.0.10
dandi==0.61.2
dandischema==0.10.1
dask==2024.5.1
-e git+https://github.com/AllenInstitute/openscope_databook.git@d16967fe4c3a05dd12e8b807c3b6159b72b7825d#egg=databook_utils
debugpy==1.8.1
decorator==5.1.1
defusedxml==0.7.1
dnspython==2.6.1
docutils==0.20.1
elephant==0.12.0
email_validator==2.1.1
etelemetry==0.3.1
exceptiongroup==1.2.1
executing==2.0.1
fasteners==0.19
fastjsonschema==2.19.1
fastremap==1.14.1
fonttools==4.51.0
fqdn==1.5.1
frozenlist==1.4.1
fscacher==0.4.0
fsspec==2024.5.0
future==1.0.0
gast==0.4.0
greenlet==3.0.3
h11==0.14.0
h5py==3.11.0
hdmf==3.14.0
httpcore==1.0.5
httpx==0.27.0
humanize==4.9.0
idna==3.7
imagecodecs==2024.1.1
imageio==2.34.1
imagesize==1.4.1
importlib-metadata==4.13.0
iniconfig==2.0.0
interleave==0.2.1
ipydatagrid==1.3.1
ipydatawidgets==4.3.2
ipyfilechooser==0.6.0
ipykernel==6.29.4
ipympl==0.9.4
ipython==8.21.0
ipython-genutils==0.2.0
ipytree==0.2.2
ipyvolume==0.6.3
ipyvue==1.11.1
ipyvuetify==1.9.4
ipywebrtc==0.6.0
ipywidgets==7.8.1
isodate==0.6.1
isoduration==20.11.0
itk-core==5.4.0
itk-filtering==5.4.0
itk-meshtopolydata==0.10.0
itk-numerics==5.4.0
itkwidgets==0.32.6
jaraco.classes==3.4.0
jaraco.context==5.3.0
jaraco.functools==4.0.1
jedi==0.19.1
Jinja2==3.1.4
jmespath==1.0.1
joblib==1.4.2
json5==0.9.25
jsonpointer==2.4
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
jupyter==1.0.0
jupyter-book==1.0.0
jupyter-cache==1.0.0
jupyter-console==6.6.3
jupyter-events==0.10.0
jupyter-lsp==2.2.5
jupyter_client==8.6.1
jupyter_core==5.7.2
jupyter_server==2.14.0
jupyter_server_terminals==0.5.3
jupyterlab==4.2.0
jupyterlab-widgets==1.1.7
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.1
keyring==25.2.1
keyrings.alt==5.0.1
kiwisolver==1.4.5
latexcodec==3.0.0
linkify-it-py==2.0.3
literate-dataclasses==0.0.6
llvmlite==0.42.0
locket==1.0.0
markdown-it-py==3.0.0
MarkupSafe==2.1.5
marshmallow==3.0.0rc6
matplotlib==3.6.2
matplotlib-inline==0.1.7
mdit-py-plugins==0.4.1
mdurl==0.1.2
mistune==3.0.2
more-itertools==10.2.0
mpl-interactions==0.22.0
multidict==6.0.5
munkres==1.1.4
myst-nb==1.1.0
myst-parser==2.0.0
natsort==8.4.0
nbclient==0.10.0
nbconvert==7.16.4
nbformat==5.10.4
nd2==0.10.1
ndx-grayscalevolume==0.0.2
ndx-icephys-meta==0.1.0
ndx-spectrum==0.2.2
neo==0.13.0
nest-asyncio==1.6.0
networkx==3.3
notebook==6.4.13
notebook_shim==0.2.4
numba==0.59.1
numcodecs==0.12.1
numpy==1.26.4
nwbinspector==0.4.35
nwbwidgets==0.11.3
ome-types==0.5.1.post1
opencv-python==4.9.0.80
opencv-python-headless==4.9.0.80
ophys_nway_matching @ git+https://github.com/AllenInstitute/ophys_nway_matching@545504ab55922717ab623f8ede2c521a60aa1458
overrides==7.7.0
packaging==24.0
pandas==1.5.2
pandocfilters==1.5.1
paramiko==3.4.0
parso==0.8.4
partd==1.4.2
patsy==0.5.6
Pillow==9.3.0
platformdirs==4.2.2
plotly==5.13.1
pluggy==1.5.0
prometheus_client==0.20.0
prompt-toolkit==3.0.43
psutil==5.9.8
pure-eval==0.2.2
py2vega==0.6.1
pybtex==0.24.0
pybtex-docutils==1.0.3
pycparser==2.22
pycryptodomex==3.20.0
pydantic==2.7.1
pydantic-compat==0.1.2
pydantic_core==2.18.2
pydata-sphinx-theme==0.15.2
Pygments==2.18.0
PyNaCl==1.5.0
pynwb==2.2.0
pyout==0.7.3
pyparsing==3.1.2
PyPDF2==3.0.1
pyqtgraph==0.13.7
pytest==8.2.1
pytest-cov==5.0.0
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
pythreejs==2.4.2
pytz==2024.1
PyWavelets==1.6.0
pywin32==306
pywin32-ctypes==0.2.2
pywinpty==2.0.13
PyYAML==6.0.1
pyzmq==26.0.3
qtconsole==5.5.2
QtPy==2.4.1
quantities==0.14.1
rastermap==0.1.3
referencing==0.35.1
remfile==0.1.10
requests==2.32.1
resource-backed-dask-array==0.1.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rfc3987==1.3.8
roifile==2024.3.20
rpds-py==0.18.1
ruamel.yaml==0.18.6
ruamel.yaml.clib==0.2.8
s3fs==2024.5.0
sbxreader==0.2.2
scanimage-tiff-reader==1.4.1.4
scikit-image==0.19.3
scikit-learn==1.5.0
scipy==1.9.3
semantic-version==2.10.0
Send2Trash==1.8.3
six==1.16.0
sniffio==1.3.1
snowballstemmer==2.2.0
soupsieve==2.5
Sphinx==7.3.7
sphinx-book-theme==1.1.2
sphinx-comments==0.0.3
sphinx-copybutton==0.5.2
sphinx-jupyterbook-latex==1.0.0
sphinx-multitoc-numbering==0.1.3
sphinx-thebe==0.3.1
sphinx-togglebutton==0.3.2
sphinx_design==0.5.0
sphinx_external_toc==1.0.1
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-bibtex==2.6.2
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
SQLAlchemy==2.0.30
ssm==0.0.1
stack-data==0.6.3
statsmodels==0.14.0
suite2p==0.12.1
tabulate==0.9.0
tenacity==8.3.0
tensortools==0.4
terminado==0.18.1
threadpoolctl==3.5.0
tifffile==2024.5.10
tinycss2==1.3.0
tomli==2.0.1
toolz==0.12.1
torch==1.13.1
tornado==6.4
tqdm==4.66.4
traitlets==5.6.0
traittypes==0.2.1
trimesh==4.4.0
types-python-dateutil==2.9.0.20240316
typing_extensions==4.11.0
uc-micro-py==1.0.3
uri-template==1.3.0
urllib3==2.2.1
wcwidth==0.2.13
webcolors==1.13
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==3.6.6
wrapt==1.16.0
xarray==2024.3.0
xsdata==24.3.1
yarl==1.9.4
zarr==2.13.3
zarr-checksum==0.4.0
zipp==3.18.2
zstandard==0.22.0

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/.github/CODE_OF_CONDUCT.rst)
- [X] Have you checked the [Contributing](https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/docs/CONTRIBUTING.rst) document?
- [X] Have you ensured this bug was not already [reported](https://github.com/NeurodataWithoutBorders/pynwb/issues)?
stephprince commented 4 months ago

Hi @rcpeene, thanks for submitting an issue, could you try installing pynwb>=2.6.0 and then running the stream_nwb notebook again with nwb instead of print(nwb) in the last cell?

I think this issue is related to this recursion error that was fixed in pynwb versions 2.6.0 and later. Upgrading pynwb allows the nwb html representation to be displayed when I run the stream_nwb notebook locally. But I'm not positive if that error is what's causing the kernel to crash in your case.

rcpeene commented 4 months ago

Great this worked!