我正在用RMarkdown写一篇论文,为了更好的重现性,我想把所有需要的软件都装在一个singularity容器里。不幸的是,当我尝试安装TinyTeX (这是Rmarkdown推荐的,并且我更希望TeXLive不会过度膨胀容器)时,它失败了,并显示以下错误消息(完整的构建日志粘贴到here中):
Can't locate TeXLive/TLConfig.pm in @INC (you may need to install the TeXLive::TLConfig module) (@INC contains: /~/.TinyTeX/texmf-dist/scripts/texlive /~/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ~/.TinyTeX/bin/x86_64-linux/tlmgr line 100.
BEGIN failed--compilation aborted at ~/.TinyTeX/bin/x86_64-linux/tlmgr line 100.这是构建定义文件,基本上它使用了一个非常精简的ubuntu 18.04,然后执行%post部分来安装软件
BootStrap: library
From: ubuntu:18.04
%post
# Add universe repository
echo "deb http://us.archive.ubuntu.com/ubuntu bionic universe" >> /etc/apt/sources.list
apt -y update
# Install utilites
apt install -y wget
# Install R
apt install -y r-base-core
## Install RMarkdown and TinyTeX
R --slave -e 'install.packages(c("rmarkdown","tinytex")); tinytex::install_tinytex()'
# Clean
apt-get clean
%environment
export LC_ALL="en_US.UTF-8"
%labels
Author DP我也尝试过tinytex::install_tinytex(dir="/opt/tinytex"),但这似乎没有改变任何事情。有没有人知道出了什么问题?
发布于 2019-08-20 18:50:14
该错误消息提示您的映像(或者,更可能是您的路径)缺少TeXLive::TLConfig perl模块。
我的猜测是,在安装后,路径内容不会与已安装的模块一起重新散列。最简单的解决方案是将其分为两个命令:
R --slave -e 'install.packages(c("rmarkdown","tinytex"))'
R --slave -e 'tinytex::install_tinytex()'当我在本地尝试时,安装成功。
发布于 2019-08-13 22:49:40
一个潜在有用的替代方案是,如果图像只是用于文档生成,则可以将带有rmarkdown和tex (例如https://hub.docker.com/r/rocker/verse)的docker图像转换为奇点图像。
使用singularity pull docker://rocker/verse,您可以使用verse:version_number为最新版本或特定版本执行此操作。
https://stackoverflow.com/questions/57327837
复制相似问题