Error compiling docs using build.py

Hello,
From the docs repository, I run

./build.py 2 23

and get the following

Execution halted
Command Rscript -e "bookdown::render_book('index.Rmd', output_format='bookdown::gitbook')" failed
Traceback (most recent call last):
  File "./build.py", line 113, in <module>
    main()
  File "./build.py", line 109, in main
    make_docs(docspath, stan_version, doc, formats)
  File "./build.py", line 54, in make_docs
    shexec(command)
  File "./build.py", line 35, in shexec
    raise Exception(returncode)
Exception: 1

I have installed bookdown, arm, pandoc, pandoc-citeproc, and pdflatex. I’m not quite sure how to interpret the above error. Thank you for your help!

@mitzimorris

Any chance you can try to cd into whatever directory has index.Rmd and try just running:

Rscript -e "bookdown::render_book('index.Rmd', output_format='bookdown::gitbook')"

? Looks like the error is getting swallowed up somehow. The other thing to do would be hack some more printing into build.py.

agree with Ben’s suggestion - fist check bookdown - did you install R pkg “bookdownplus” as well?

also agree that the build.py script should do a better job w/r/t errors.
filed an issue: https://github.com/stan-dev/docs/issues/219

I followed @bbbales2’s advice and did it for src/reference-manual/index.rmd. The following error message appears

Error in split_chapters(output, gitbook_page, number_sections, split_by,  : 
  Automatically generated filenames contain duplicated ones: comments, output
Calls: <Anonymous> ... <Anonymous> -> <Anonymous> -> split_chapters -> <Anonymous>
Execution halted

There is a proposed solution on this stack page, but I’m not comfortable making those kind of edits; and if indeed this were the problem, then other users should see the issue.

I just installed bookdownplus. Have we tested build.py with OS Catalina, and the most recent versions of bookdown (and the most recent versions of the packages involved)? Judging by the stack post, the reported issue appears in new versions of bookdown.

this error indicates that there are sections or chapters that have the same name.
did you add new sections to the docs?
bookdown doesn’t care about filenames - it uses chapter and section titles.

OK, @charlesm93 is correct - something’s fubar -

will investigate.

@charlesm93 - fixed the problem for the reference manual (on master) - should build for you now.

I don’t know why this started to fail, but as none of the files or config has changed, I blame R, bookdown, and the rest of the usual suspects. because according to github, we’re blameless.

Hi Mitzi,

Thanks for looking into this. I didn’t make any changes to the branch when I tried running build.py. Your correction seems to have fixed the above mentioned error. But something is still not working.

After installing a handful of additional R packages (Bayesplot, kableExtra, lubridate) – btw, it would be good to list all the dependencies or have them all checked upfront --, I now run into a segmentation fault.

 *** caught segfault ***
address 0x10afbfffc, cause 'memory not mapped'

Traceback:
 1: paste(x, ..., collapse = "\n")
 2: one_string((knit_hooks$get("document"))(res))
 3: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
 4: rmarkdown::render(main, output_format, ..., clean = clean, envir = envir)
 5: render_cur_session(files, main, config, output_format, clean,     envir, ...)
 6: bookdown::render_book("index.Rmd", output_format = "bookdown::gitbook")
An irrecoverable exception occurred. R is aborting now ...
Command Rscript -e "bookdown::render_book('index.Rmd', output_format='bookdown::gitbook')" failed
Traceback (most recent call last):
  File "./build.py", line 113, in <module>
    main()
  File "./build.py", line 109, in main
    make_docs(docspath, stan_version, doc, formats)
  File "./build.py", line 54, in make_docs
    shexec(command)
  File "./build.py", line 35, in shexec
    raise Exception(returncode)
Exception: -11

I’ll see if I can debug it but this isn’t code I’m super familiar with. Are we running Stan code when compiling the manual? And if so, which version of Stan has the compilation been tested on?

EDIT: Still didn’t find the solution, but at least the html files renders, so I can write and check changes.

we are so not running Stan code when compiling the manual.
is the problem still the Stan Reference Manual? or?
feel free to file issues on the docs repo - all good suggestions above.

Oh yeah, I guess it makes sense.

The commend I use is ./build.py so it’s hard to pinpoint where the error comes from. Also, I was able to run build.py without getting the error. I guess this isn’t uncommon for segfault error, that they appear somewhat inconsistently. I’ll file an issue.

1 Like