简体   繁体   中英

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().

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.

Also, if I call Rscript from the command line it runs fine.

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. 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.

Solution: delete the offending line in.REnviron in your home folder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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