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

With knitr 1.34 and bookdown 0.21 I get the following for gitbook - Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : object 'is_abs_path' not found #2042

Closed
3 tasks done
N0rbert opened this issue Sep 10, 2021 · 4 comments

Comments

@N0rbert
Copy link

N0rbert commented Sep 10, 2021

I have just configured fresh Ubuntu MATE 20.04.3 LTS virtual machine. As usual I installed here R and RStudio.

As you may remember I need to have bookdown 0.21 to get my project compiled (because of rstudio/bookdown#1202 ). I installed bookdown 0.21 using the following command:

R -e "require(devtools); install_version('bookdown', version = '0.21', repos = 'http://cran.rstudio.com')"

Then I tried to compile my 2 year old project using it and it failed.
After some research I wrote minimal reproducible example index.Rmd file with following contents:

---
title: Test for Knitr 1.34
date: "`r Sys.Date()`"

documentclass: book

site: bookdown::bookdown_site
output:
  bookdown::gitbook: default

---

# Abstract {-#abstract}

This is simplest document to demonstrate the problem with modern Knitr 1.34.

If I click Knit button inside RStudio I get the following output on R Markdown tab:

Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'is_abs_path' not found
Calls: <Anonymous> ... <Anonymous> -> <Anonymous> -> move_files_html -> ::: -> get
Please delete _main.Rmd after you finish debugging the error.
Execution halted

If I compile it using terminal inside RStudio by command rm _main.* ; Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')" I get relatively same result:

$ rm _main.* ; Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')"


processing file: _main.Rmd
  |......................................................................| 100%
   inline R code fragments


output file: _main.knit.md

/usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS _main.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output _main.html --lua-filter /home/mate/R/x86_64-pc-linux-gnu-library/3.6/bookdown/rmarkdown/lua/custom-environment.lua --lua-filter /home/mate/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/mate/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmarkdown/lua/latex-div.lua --wrap preserve --standalone --section-divs --table-of-contents --toc-depth 3 --template /home/mate/R/x86_64-pc-linux-gnu-library/3.6/bookdown/templates/gitbook.html --highlight-style pygments --number-sections --include-in-header /tmp/RtmpMmifgF/rmarkdown-str15f5c1bae1cf3.html --mathjax 
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'is_abs_path' not found
Calls: <Anonymous> ... <Anonymous> -> <Anonymous> -> move_files_html -> ::: -> get
Please delete _main.Rmd after you finish debugging the error.
Execution halted

The issue does not exist in previous Knitr 1.33, which was installed previously on my other system. I get the same document compiled successfully using it:

$ R -e "require(devtools); install_version('knitr', version = '1.33', repos = 'http://cran.rstudio.com')"
$ rm _main.* ; Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')"


processing file: _main.Rmd
  |......................................................................| 100%
   inline R code fragments


output file: _main.knit.md

/usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS _main.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output _main.html --lua-filter /home/mate/R/x86_64-pc-linux-gnu-library/3.6/bookdown/rmarkdown/lua/custom-environment.lua --lua-filter /home/mate/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/mate/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmarkdown/lua/latex-div.lua --wrap preserve --standalone --section-divs --table-of-contents --toc-depth 3 --template /home/mate/R/x86_64-pc-linux-gnu-library/3.6/bookdown/templates/gitbook.html --highlight-style pygments --number-sections --include-in-header /tmp/RtmpxUMxyi/rmarkdown-str15fce25e23e09.html --mathjax 

Output created: _book/index.html
[1] "/home/mate/Downloads/bookdown-demo-rus/_book/index.html"

Please have a fallback for is_abs_path on knitr side.


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/knitr').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

> xfun::session_info('knitr')
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS, RStudio 1.4.1717

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=ru_RU.UTF-8       
  LC_COLLATE=en_US.UTF-8     LC_MONETARY=ru_RU.UTF-8    LC_MESSAGES=en_US.UTF-8   
  LC_PAPER=ru_RU.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
  LC_TELEPHONE=C             LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C       

Package version:
  evaluate_0.14   glue_1.4.2      graphics_3.6.3  grDevices_3.6.3 highr_0.9      
  knitr_1.34      magrittr_2.0.1  methods_3.6.3   stats_3.6.3     stringi_1.7.4  
  stringr_1.4.0   tools_3.6.3     utils_3.6.3     xfun_0.25       yaml_2.2.1     
> 

> xfun::session_info('bookdown')
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS, RStudio 1.4.1717

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=ru_RU.UTF-8       
  LC_COLLATE=en_US.UTF-8     LC_MONETARY=ru_RU.UTF-8    LC_MESSAGES=en_US.UTF-8   
  LC_PAPER=ru_RU.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
  LC_TELEPHONE=C             LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C       

Package version:
  base64enc_0.1.3 bookdown_0.21   digest_0.6.27   evaluate_0.14   fastmap_1.1.0   glue_1.4.2     
  graphics_3.6.3  grDevices_3.6.3 highr_0.9       htmltools_0.5.2 jsonlite_1.7.2  knitr_1.34     
  magrittr_2.0.1  methods_3.6.3   rlang_0.4.11    rmarkdown_2.10  stats_3.6.3     stringi_1.7.4  
  stringr_1.4.0   tinytex_0.33    tools_3.6.3     utils_3.6.3     xfun_0.25       yaml_2.2.1     
> 
@yihui
Copy link
Owner

yihui commented Sep 10, 2021

This is_abs_path() function has been removed in knitr 1.34: https://github.com/yihui/knitr/releases/tag/v1.34

If you want to use an older version of bookdown, I'm afraid you have to use an older version of knitr accordingly.

@N0rbert
Copy link
Author

N0rbert commented Sep 10, 2021

Thanks!
I have already decided to use older versions for both applications. Really I do not want to make my Rmd environment full of hacks and version locks.
I still hope that you revert is_abs_path removal for better compatibility.

@yihui
Copy link
Owner

yihui commented Sep 12, 2021

Thanks for your patience! We'll fix rstudio/bookdown#1202.

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants