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

AssertionError in depart_codearea_latex() #781

Closed
hakonanes opened this issue Mar 30, 2024 · 4 comments
Closed

AssertionError in depart_codearea_latex() #781

hakonanes opened this issue Mar 30, 2024 · 4 comments

Comments

@hakonanes
Copy link

hakonanes commented Mar 30, 2024

Hi, and thanks again for creating and maintaining nbsphinx.

The RTD LaTeX builds of orix (https://beta.readthedocs.org/projects/orix/builds/23890511/) have started throwing an AssertionError in these lines:

# Sphinx 4.1.0 added "sphinxuseclass" environments around "sphinxVerbatim"
for begin_verbatim, line in enumerate(lines):
if line.startswith(r'\begin{sphinxVerbatim}'):
break
else:
assert False

The traceback:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/sphinx/cmd/build.py", line 298, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/sphinx/application.py", line 355, in build
    self.builder.build_update()
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 290, in build_update
    self.build(['__all__'], to_build)
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 363, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/sphinx/builders/latex/__init__.py", line 318, in write
    docwriter.write(doctree, destination)
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/docutils/writers/__init__.py", line 80, in write
    self.translate()
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/sphinx/writers/latex.py", line 88, in translate
    self.document.walkabout(visitor)
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/docutils/nodes.py", line 186, in walkabout
    if child.walkabout(visitor):
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/docutils/nodes.py", line 186, in walkabout
    if child.walkabout(visitor):
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/docutils/nodes.py", line 186, in walkabout
    if child.walkabout(visitor):
       ^^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 10 more times]
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/docutils/nodes.py", line 199, in walkabout
    visitor.dispatch_departure(self)
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/sphinx/util/docutils.py", line 599, in dispatch_departure
    method(node)
  File "/home/docs/checkouts/readthedocs.org/user_builds/orix/conda/latest/lib/python3.11/site-packages/nbsphinx/__init__.py", line 1875, in depart_codearea_latex
    assert False
AssertionError

Versions:

  • Sphinx 7.2.6
  • nbsphinx 0.9.3

Note that I can't reproduce locally on macOS, so I'm not sure how easy it will be to debug this. I can reproduce this on my Mac. If necessary, I can create a MWE. Any insight from nbsphinx developers would be appreciated.

For reference, we're tracking our issue here: pyxem/orix#475.

@mgeier
Copy link
Member

mgeier commented Mar 30, 2024

Thanks for the report!

It would be ideal if you could provide a minimal .ipynb file that reproduces the problem.
Even if it's not minimal, it would also help if you could provide a notebook with the code cell outputs.

@hakonanes
Copy link
Author

I'm 99% certain this issue results from tqdm compatibility as reported in #776.

This is how the progressbars look in our online docs now (here):

bilde

@mgeier
Copy link
Member

mgeier commented May 5, 2024

#776 has been fixed in nbconvert release v7.16.4. Can you please check if that happens to fix your problem as well?

@hakonanes
Copy link
Author

I can confirm that using nbconvert 7.16.4 fixed our problem, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants