ford
ford copied to clipboard
RecursionError: maximum recursion depth exceeded while calling a Python object
Hi,
When I run FORD I get the following error. I made no change on source codes or FORD project file after I had ran without problem a while ago, probably before upgrading the installed version.
Traceback (most recent call last):
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\Scripts\ford.exe\__main__.py", line 7, in <module>
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\lib\site-packages\ford\__init__.py", line 647, in run
main(proj_data, proj_docs, md)
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\lib\site-packages\ford\__init__.py", line 596, in main
project.make_links(base_url)
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\lib\site-packages\ford\fortran_project.py", line 326, in make_links
src.make_links(self)
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\lib\site-packages\ford\sourceform.py", line 461, in make_links
item.make_links(project)
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\lib\site-packages\ford\sourceform.py", line 461, in make_links
item.make_links(project)
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\lib\site-packages\ford\sourceform.py", line 461, in make_links
item.make_links(project)
[Previous line repeated 988 more times]
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\lib\site-packages\ford\sourceform.py", line 454, in make_links
self.doc = ford.utils.sub_links(self.doc, project)
File "C:\Users\tuncaen\AppData\Local\Programs\Python\Python310\lib\site-packages\ford\utils.py", line 322, in sub_links
string = LINK_RE.sub(convert_link, string)
RecursionError: maximum recursion depth exceeded while calling a Python object
The project file:
project: UIHES_v1.00
src_dir: ../src/
page_dir:../md
md_extensions: markdown.extensions.toc
md_base_dir: ../src_comment/
output_dir: ../doc/
media_dir: ../ford-data/
sort: src
author: Enes Tunca
author_description: PhD Candidate @ITU Naval Architecture
github: https://github.com/tuncaen
email: mailto:[email protected]
docmark: <
predocmark: >
predocmark_alt: #
display: public
protected
private
source: true
graph: true
search: true
parallel: 4
warn: true
preprocess: false
FWIW, I get a similar error when using the option graph_dir
to output the graphs to a given directory:
I am getting same new error as original poster above after starting to write the graph files:
.
.
.
Creating search index: 100%|██████████| 1030/1030 [00:38<00:00, 27.08/s]
/gpfs/fs1/neptune/software/miniconda3/envs/ford/lib/python3.9/site-packages/ford/graphs.py:1399: TqdmWarning: Iterable length 1164 > 1000 but `chunksize` is not set. This may seriously degrade multiprocess performance. Set `chunksize=1` or more.
process_map(
Writing documentation to '/gpfs/fs1/blanked_out_username/gh_runners/r1/_work/blanked_out/blanked_out/blanked_out/docs/ford_fortran_doc'...
Writing graphs: 0%| | 0/1164 [00:00<?, ?it/s]
Writing graphs: 0%| | 0/1164 [00:00<?, ?it/s]
concurrent.futures.process._RemoteTraceback:
"""
Traceback (most recent call last):
File "/gpfs/fs1/blanked_out/software/miniconda3/envs/ford/lib/python3.9/multiprocessing/queues.py", line 244, in _feed
obj = _ForkingPickler.dumps(obj)
File "/gpfs/fs1/blanked_out/software/miniconda3/envs/ford/lib/python3.9/multiprocessing/reduction.py", line 51, in dumps
cls(buf, protocol).dump(obj)
RecursionError: maximum recursion depth exceeded while pickling an object
.
.
.
This error started occuring after upgrading from FORD version 6.1.17 to 6.2.5 with the following commands:
source activate ford
python –m pip install --upgrade pip
python –m pip install --upgrade ford
The FORD project file is:
project: (removed for security)
summary: (removed for security)
author: (removed for security)
project_github: (removed for security)
src_dir: ../src
exclude_dir: ../src/m4
include: ../src
incl_src: false
output_dir: ford_fortran_doc
preprocess: True
preprocessor: pcpp --passthru-comments
max_frontpage_items: 1000
print_creation_date: true
creation_date: %Y-%m-%d %H:%M:%S.%f%z
graph: True
graph_dir: ford_fortran_doc/graphs
macro: (removed for security)
Thanks for the bug report, please could someone link to a project, or even better a minimal example, that reproduces this?
Unfortunately, in my case, the project that produced this error is not publicly accessible and my employer will not allow me to provide access to it.
The problem with providing an example that demonstrates the problem is that the problem seems to be tied to project size. I have no idea what produced the error in the latest FORD version, but, if I had to guess, it would be FORD's recent improvement in handling type-bound procedures (perhaps with respect to the call graph).
My temporary workaround is to disable graphs and the search function. In the interest of speed, I have done this anyway in the midst of converting comments to FORD autodoc comments.
Unfortunately in my case the project is also not public. The workaround I found was to add sys.setrecursionlimit(100000)
to the file reduction.py
.
@jmbcastro where in reduction.py
did you put it?
Hi @patflynngithub, I put it immediately after the import statements.