jeroenjanssens / data-science-at-the-command-line

Data Science at the Command Line
https://datascienceatthecommandline.com
Other
3.8k stars 764 forks source link

Unclear build instructions and tmuxr failure #144

Open gl-yziquel opened 1 year ago

gl-yziquel commented 1 year ago

Hi.

I've been trying to build the book from source on ubuntu.

The documentation is rather unclear as to how this book should be built.

After some dependency hunting, I am now hitting the following wall, which seems to be linked to tmuxr behaviour:

mini-me@virtucon ~/h/c/d/b/2e (master)> Rscript --vanilla -e 'bookdown::render_book("index.Rmd", encoding = "UTF-8", clean = FALSE)'
processing file: index.Rmd
output file: index.knit.md
processing file: foreword.Rmd
output file: foreword.knit.md
processing file: preface.Rmd
output file: preface.knit.md
processing file: 01.Rmd
  |.......                                             |  13% [console_start]  
Quitting from lines 6-7 [console_start] (01.Rmd)
Error:
! tmux: can't find pane: %405
Backtrace:
  1. global console_start()
  2. knitractive::start(...)
  3. engine$start()
  4. rexpect::expect_prompt(self$session)
  5. rexpect::ends_with_prompt(session)
  8. rexpect::read_last_line(session)
  9. tmuxr::capture_pane(session, start = n, end = n)
 10. tmuxr::tmux_command("capture-pane", flags)
Execution halted
Error in Rscript_render(f, render_args, render_meta, add1, add2) : 
  Failed to compile 01.Rmd
Calls: <Anonymous> -> render_new_session -> Rscript_render
Execution halted
mini-me@virtucon ~/h/c/d/b/2e (master) [1]> 

Is this behaviour potentially linked to the fact that I am already using tmux for my daily work ? (I've been building this OUT of tmux, but with another tmux running along, which is necessary for my current work, and which I cannot kill; when building INSIDE tmux, the command above kills the pane in which it is being executed, which is unfortunate.)

kurokirasama commented 4 months ago

I'm getting this error:

processing file: index.Rmd

output file: index.knit.md

processing file: foreword.Rmd

output file: foreword.knit.md

processing file: preface.Rmd

output file: preface.knit.md

processing file: 01.Rmd
  |.......                                             |  13% [console_start]  Error:
! ! Native call to `processx_exec` failed
Caused by error in `chain_call(c_processx_exec, command, c(command, args), pty, pty_options, …`:
! cannot start processx process 'tmux' (system error 2, No such file or directory) @unix/processx.c:611 (processx_exec)
Backtrace:
  1. global console_start()
 14. base::.handleSimpleError(...)
 15. h(simpleError(msg, call))
 16. throw_error(err, parent = e)

Quitting from lines 6-7 [console_start] (01.Rmd)

Execution halted
Error in `process_initialize(self, private, command, args, stdin, stdout, …`:
! Native call to `processx_exec` failed
Caused by error in `chain_call(c_processx_exec, command, c(command, args), pty, pty_options, …`:
! cannot start processx process 'tmux' (system error 2, No such file or directory) @unix/processx.c:611 (processx_exec)
---
Backtrace:
 1. base::(function (e) …
 2. .subset2(e, "finalize")()
 3. self$stop()
 4. rexpect::exit(self$session)
 5. tmuxr::kill_pane(session$pane)
 6. tmuxr::tmux_command("kill-pane", flags)
 7. processx::run(getOption("tmux_binary", "tmux"), args = c(tmux_options, …
 8. process$new(command, args, echo_cmd = echo_cmd, wd = wd, windows_verbatim_args = windows_verb…
 9. local initialize(...)
10. processx:::process_initialize(self, private, command, args, stdin, stdout, …
11. processx:::chain_call(c_processx_exec, command, c(command, args), pty, pty_options, …
12. | base::withCallingHandlers(do.call(".Call", list(.NAME, ...)), error = function(e) { …
13. | base::do.call(".Call", list(.NAME, ...))
14. | base::.handleSimpleError(function (e) …
15. | local h(simpleError(msg, call))
16. | processx:::throw_error(err, parent = e)
Error in Rscript_render(f, render_args, render_meta, add1, add2) : 
  Failed to compile 01.Rmd
Calls: <Anonymous> -> render_new_session -> Rscript_render
Execution halted
cameronj86 commented 3 weeks ago

FYI: If you just want to create the ePub without the interactive command-line elements, you can modify the Rmd files to skip those parts. (It was getting a little in the weeds for me installing tmux into my Rstudio docker container lol):


# Backup first
cp -r . ../book_backup

# Comment out the console blocks
sed -i '/^```{r console_start/,/^```$/s/^/# /' *.Rmd
sed -i '/^```{console setup_history/,/^```$/s/^/# /' *.Rmd
# (Assistance from Claude AI)

Hopefully it doesn't detract too much from the overall experience of the book