S kevin
S kevin

Reputation: 1

Unable to install the `tinytex` package on Windows due to incompatible `xfun` version

I am encountering an issue while trying to install the R package tinytex. After made some investigations and I guess it might due to the dependency of xfun:

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'xfun' 0.43 is being loaded, but >= 0.48 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Full Logs from Console
> install.packages("tinytex")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/kevin/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
also installing the dependency ‘xfun’


  There are binary versions available but the source versions are later:
        binary source needs_compilation
xfun      0.43   0.49              TRUE
tinytex   0.50   0.54             FALSE

  Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/xfun_0.43.zip'
Content type 'application/zip' length 483588 bytes (472 KB)
downloaded 472 KB

package ‘xfun’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\kevin\AppData\Local\Temp\Rtmp25kkFg\downloaded_packages
installing the source package ‘tinytex’

trying URL 'https://cran.rstudio.com/src/contrib/tinytex_0.54.tar.gz'
Content type 'application/x-gzip' length 35584 bytes (34 KB)
downloaded 34 KB

* installing *source* package 'tinytex' ...
** package 'tinytex' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'xfun' 0.43 is being loaded, but >= 0.48 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted
ERROR: lazy loading failed for package 'tinytex'
* removing 'C:/Users/kevin/AppData/Local/R/win-library/4.2/tinytex'
* restoring previous 'C:/Users/kevin/AppData/Local/R/win-library/4.2/tinytex'

However I am unable to install xfun version 0.49 from CRAN, has anyone encountered a similar issue?

Session info
> xfun::session_info('xfun')
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044), RStudio 2024.4.2.764

Locale:
  LC_COLLATE=English_Hong Kong SAR.utf8  LC_CTYPE=English_Hong Kong SAR.utf8   
  LC_MONETARY=English_Hong Kong SAR.utf8 LC_NUMERIC=C                          
  LC_TIME=English_Hong Kong SAR.utf8    

Package version:
  graphics_4.2.1  grDevices_4.2.1 stats_4.2.1     tools_4.2.1     utils_4.2.1     xfun_0.43    

How can I successfully install tinytex(if possible, avoiding Rtools)? Honestly, I am not sure how to pinpoint my problem right now. My initial demand was to use pagedown to create a PDF file from markdown, but the creation failed. The render process prompted me to install tinytex, and then I try to investigate the issue following the guidance(https://yihui.org/tinytex/r/#debugging), finally I got lost in the errors....

Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips.
In addition: Warning messages:
1: In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  '"pdflatex"' not found
2: In system2(...) : '"pdflatex"' not found
Execution halted

No LaTeX installation detected (LaTeX is required to create PDF output). You should install a LaTeX distribution for your platform: https://www.latex-project.org/get/

  If you are not sure, you may install TinyTeX in R: tinytex::install_tinytex()

  Otherwise consider MiKTeX on Windows - http://miktex.org

  MacTeX on macOS - https://tug.org/mactex/
  (NOTE: Download with Safari rather than Chrome _strongly_ recommended)

  Linux: Use system package manager

My issue occurred during installation, but that problem seems to be about execution; I tried installing from CRAN, but it failed.

Upvotes: 0

Views: 24

Answers (0)

Related Questions