nrn icon indicating copy to clipboard operation
nrn copied to clipboard

Failure to build docs on release 8.2

Open JCGoran opened this issue 5 months ago • 1 comments

Context

This file in the documentation fails to get converted when running make docs, with the error:

Traceback (most recent call last):
  File "/Users/jelic/software/nrn/env_arm64/bin/jupyter-nbconvert", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/jupyter_core/application.py", line 283, in launch_instance
    super().launch_instance(argv=argv, **kwargs)
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/traitlets/config/application.py", line 1075, in launch_instance
    app.start()
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 420, in start
    self.convert_notebooks()
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 597, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 563, in convert_single_notebook
    output, resources = self.export_single_notebook(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 487, in export_single_notebook
    output, resources = self.exporter.from_filename(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 201, in from_filename
    return self.from_file(f, resources=resources, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 220, in from_file
    return self.from_notebook_node(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/exporters/notebook.py", line 36, in from_notebook_node
    nb_copy, resources = super().from_notebook_node(nb, resources, **kw)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 154, in from_notebook_node
    nb_copy, resources = self._preprocess(nb_copy, resources)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 353, in _preprocess
    nbc, resc = preprocessor(nbc, resc)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/preprocessors/base.py", line 48, in __call__
    return self.preprocess(nb, resources)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py", line 102, in preprocess
    self.preprocess_cell(cell, resources, index)
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py", line 123, in preprocess_cell
    cell = self.execute_cell(cell, index, store_history=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 165, in wrapped
    return loop.run_until_complete(inner)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_compl
ete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/jelic/software/nrn/env_arm64/lib/python3.11/site-packages/nbclient/client.py", line 1009, in async_execute_cell
    raise DeadKernelError("Kernel died") from None
nbclient.exceptions.DeadKernelError: Kernel died

The same issue happens when running the notebook in an interactive session.

After some debugging by using jupyter nbconvert --to notebook --inplace --Application.log_level=DEBUG --execute, the issue seems to be this line here: https://github.com/neuronsimulator/nrn/blob/8e483a912e35f0e919746b71ac251acc0676671a/docs/rxd-tutorials/extracellular.ipynb#L423 Going down the rabbit hole, it seems that the responsible line in that function call is: https://github.com/neuronsimulator/nrn/blob/8e483a912e35f0e919746b71ac251acc0676671a/docs/rxd-tutorials/extracellular.ipynb#L272

I've also tried to convert the notebook to a script, and, curiously enough, I get a segfault (after commenting out the nrnivmodl line) when running python extracellular.py (converted using jupyter nbconvert --to script docs/rxd-tutorials/extracellular.ipynb). Curiously, when I apply this diff:

diff --git a/empty/extracellular.py b/empty/extracellular.py
index 6abbf5d62..2b6fb54ac 100644
--- a/empty/extracellular.py
+++ b/empty/extracellular.py
@@ -35,7 +35,6 @@ urlretrieve(
     "c91662.swc",
 )
 
-!nrnivmodl
 
 from neuron import h, crxd as rxd
 
@@ -120,9 +119,9 @@ def runsim(species, min_conc=3, max_conc=4, frames=1000):
     anim = animation.FuncAnimation(
         fig, animate, init_func=init, frames=frames, interval=10
     )
-    ret = HTML(anim.to_html5_video())
-    pyplot.close()
-    return ret
+    #ret = HTML(anim.to_html5_video())
+    #pyplot.close()
+    #return ret
 
 runsim(k, min_conc=3, max_conc=4)

it runs fine.

Note that the issue is also present on the current stable release, 8.2.3.

Also note that the automated build on RTD fails with a different error (see here).

Python packages and versions

This is on Python 3.11, but I am able to reproduce also with Python 3.9.

alabaster==0.7.16
anyio==4.2.0
appnope==0.1.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==2.4.1
async-lru==2.0.4
attrs==23.2.0
Babel==2.14.0
beautifulsoup4==4.12.3
bleach==6.1.0
bokeh==2.4.3
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
comm==0.2.1
commonmark==0.9.1
contourpy==1.2.0
coverage==7.4.1
cycler==0.12.1
Cython==0.29.37
debugpy==1.8.0
decorator==5.1.1
defusedxml==0.7.1
distro==1.9.0
docutils==0.20.1
executing==2.0.1
fastjsonschema==2.19.1
fonttools==4.47.2
fqdn==1.5.1
h11==0.14.0
httpcore==1.0.2
httpx==0.26.0
idna==3.6
imagesize==1.4.1
iniconfig==2.0.0
ipykernel==6.29.1
ipython==8.21.0
ipywidgets==8.1.1
isoduration==20.11.0
jedi==0.19.1
Jinja2==3.1.3
json5==0.9.14
jsonpointer==2.4
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
jupyter==1.0.0
jupyter-console==6.6.3
jupyter-events==0.9.0
jupyter-lsp==2.2.2
jupyter_client==8.6.0
jupyter_core==5.7.1
jupyter_server==2.12.5
jupyter_server_terminals==0.5.2
jupyterlab==4.1.0
jupyterlab-widgets==3.0.9
jupyterlab_pygments==0.3.0
jupyterlab_server==2.25.2
kiwisolver==1.4.5
MarkupSafe==2.1.5
matplotlib==3.8.2
matplotlib-inline==0.1.6
mistune==3.0.2
mizani==0.9.3
mpi4py==3.1.5
nbclient==0.9.0
nbconvert==7.15.0
nbformat==5.9.2
nbsphinx==0.9.3
nest-asyncio==1.6.0
notebook==7.0.7
notebook_shim==0.2.3
numpy==1.26.4
overrides==7.7.0
packaging==21.3
pandas==2.2.0
pandocfilters==1.5.1
parso==0.8.3
patsy==0.5.6
pexpect==4.9.0
pillow==10.2.0
platformdirs==4.2.0
plotly==5.18.0
plotnine==0.12.4
pluggy==1.4.0
prometheus-client==0.19.0
prompt-toolkit==3.0.43
psutil==5.9.8
ptyprocess==0.7.0
pure-eval==0.2.2
pycparser==2.21
Pygments==2.17.2
pyparsing==3.1.1
pytest==8.0.0
pytest-cov==4.1.0
python-dateutil==2.8.2
python-json-logger==2.0.7
pytz==2024.1
PyYAML==6.0.1
pyzmq==25.1.2
qtconsole==5.5.1
QtPy==2.4.1
recommonmark==0.7.1
referencing==0.33.0
requests==2.31.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.17.1
scikit-build==0.17.6
scipy==1.12.0
Send2Trash==1.8.2
six==1.16.0
sniffio==1.3.0
snowballstemmer==2.2.0
soupsieve==2.5
Sphinx==7.2.6
sphinx-rtd-theme==2.0.0
sphinx_design==0.5.0
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
stack-data==0.6.3
statsmodels==0.14.1
tenacity==8.2.3
terminado==0.18.0
tinycss2==1.2.1
tornado==6.4
traitlets==5.14.1
types-python-dateutil==2.8.19.20240106
typing_extensions==4.9.0
tzdata==2023.4
uri-template==1.3.0
urllib3==2.2.0
wcwidth==0.2.13
webcolors==1.13
webencodings==0.5.1
websocket-client==1.7.0
widgetsnbextension==4.0.9

JCGoran avatar Feb 06 '24 17:02 JCGoran