简体   繁体   English

R,macosx,Rscript 致命错误:为“-e”创建临时文件失败

[英]R, macosx, Rscript Fatal error: creating temporary file for '-e' failed

I'm running R 3.6.0 on Mac osx 10.11.6 (El Capitan) and get an "Fatal error: creating temporary file for '-e' failed" error when calling Rscript via system().我在 Mac osx 10.11.6 (El Capitan) 上运行 R 3.6.0 并在通过 system() 调用 Rscript 时收到“致命错误:为 '-e' 创建临时文件失败”错误。

test_cmd <- "/Library/Frameworks/R.framework/Resources/bin/Rscript -e 'print(\"Hello\")'"
system(test_cmd, intern = TRUE)

That returns this error:这将返回此错误:

[1] "Fatal error: creating temporary file for '-e' failed"
attr(,"status")
[1] 2
Warning message:
In system(test_cmd, intern = TRUE) :
  running command '/Library/Frameworks/R.framework/Resources/bin/Rscript -e 'print("Hello")'' had status 2

I get this error when trying to make a cluster via future, which led me to this specific example.尝试通过未来创建集群时出现此错误,这使我想到了这个特定的示例。

future::makeClusterPSOCK(1, outfile = NULL, verbose = TRUE)

That also calls Rscript and fails with the same error.这也调用 Rscript 并失败并出现相同的错误。

Also, if I call Rscript from the command line it runs fine.另外,如果我从命令行调用 Rscript 它运行良好。

I sorted it out - I had set the TMPDIR variable in my.REnviron file about a year ago while trying to fix something else I guess.我把它整理出来——大约一年前,我在我的.REnviron 文件中设置了 TMPDIR 变量,同时试图修复我猜的其他东西。 That folder wasn't valid and was only used when a system call was ran.该文件夹无效,仅在运行系统调用时使用。 Upgrading R to 3.6.1 didn't fix this as that file stayed there.将 R 升级到 3.6.1 并没有解决这个问题,因为该文件保留在那里。

Solution: delete the offending line in.REnviron in your home folder解决方案:删除主文件夹中.REnviron 中的违规行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM