Recursion error: maximum recursion depth exceeded in comparison¶
Sphinx build failed with error:
Recursion error: maximum recursion depth exceeded in comparison This can happen with very large or deeply nested source files. You can carefully increase the default Python recursion limit of 1000 in conf.py with e.g.: import sys; sys.setrecursionlimit(1500)
This rare issue usually occurs by human error. The common cause is creating circle reference between documents in a
second.rst, and vise versa,
index.rst. This creates circular reference that will quickly exhause Python recursion limit when Sphinx analyses documents.
First ===== .. toctree:: second
Second ====== .. toctree:: index
Fix circular reference in
toctrees. In previous example,
second.rst refer to
index by error.