Windows环境下安装R包tinytex因xfun版本不兼容失败求助
Windows下安装tinytex失败,依赖xfun版本兼容问题
在Windows环境下安装R包tinytex时遇到问题,推测是依赖包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
控制台完整日志
> 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: 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 '[CRAN binary URL]' 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 '[CRAN source URL]' 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'
会话信息
> 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
初始渲染错误
最初需求是用pagedown将Markdown文件转为PDF,渲染失败提示安装tinytex,错误信息如下:
Error: LaTeX failed to compile test.tex. See [debugging tips URL] 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: [LaTeX download URL] If you are not sure, you may install TinyTeX in R: tinytex::install_tinytex() Otherwise consider MiKTeX on Windows - [MiKTeX download URL] MacTeX on macOS - [MacTeX download URL] (NOTE: Download with Safari rather than Chrome _strongly_ recommended) Linux: Use system package manager
提问
无法从CRAN安装xfun 0.49版本,请问如何成功安装tinytex(尽量避免使用Rtools)?
内容的提问来源于stack exchange,提问作者S kevin
相关产品推荐
相关产品推荐

