简体   繁体   中英

Rscript execution error: No such file or directory

The binary of Rscript is available but when I try to use it I get:

Rscript helloworld.r

Rscript execution error: No such file or directory

If I just do Rscript, it brings the help/usage for it through.

R CMD BATCH is working fine.

I tried adding shebang lines in the R code at the start but it didn't work.

#!/sys_apps_01/R/R-3.2.0/bin/R

#!/sys_apps_01/R/R-3.2.0/bin/Rscript

It's likely this was installed to (configured for) another directory and then moved after installation. Afterwards Rscript won't be able to find the (hardcoded?) R binary. I just had the same problem, which could be solved by reinstalling R.

Andreas

As in your case, this was caused by me moving R (in order to try to use it in an AWS lambda function).

I resorted to doing the equivalent call on R itself:

./R --slave --no-restore --file=TheScript.R

I preface this solution issuing a caution to do this at one's own risk. However I encountered the same issue and had the following solution:

Say you've run make && make install which has installed R to /path/to/install/loc . Once you've moved this to path/to/new/loc , R/Rscript will then complain it can't find the right file/directory.

Editing the R and Rscript executables in path/to/new/loc/bin , you can change any reference to /path/to/old/loc to /path/to/new/loc . This has worked for me and haven't encountered any further issues

As has been previously mentioned, it's definitely preferable to install R to the required location either through prefix=... in the configure script, or by using the rhome=... argument following make install

I encountered the same issue. What happened in my case was that, R was first installed at /usr/lib/R with deb packages, then I moved the dir to /opt/R and defined R_HOME to the new dir, hoping R will adapt to it automatically, but turns out there are hardcoded paths of /usr/lib/R in bin/R . Unless I update the paths, simply moving R to another location will break the installation.

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