如何让RStudio识别我安装到
的R版本/opt/R/3.4.3/
自己编译(make install
)和ln -s /opt/R/${R_VERSION}/bin/R /bin/R
。在shell上执行时,R工作正常。只有RStudio无法识别不同的路径,仍在查看:
/usr/local/lib64/R/bin/exec/R
确切的错误消息:
Feb 3 14:50:18 devbox systemd: Starting RStudio Server...
Feb 3 14:50:18 devbox systemd: Started RStudio Server.
Feb 3 14:50:18 devbox rserver[22411]: ERROR R did not return any output when queried for directory location information; LOGGED FROM: bool rstudio::core::r_util::<unnamed>::detectRLocationsUsingR(const std::string&, rstudio::core::FilePath*, rstudio::core::FilePath*, rstudio::core::config_utils::Variables*, std::string*) /root/rstudio/src/cpp/core/r_util/REnvironmentPosix.cpp:483
Feb 3 14:50:18 devbox rserver[22411]: ERROR system error 71 (Protocol error) [description=Unable to parse version from R, version-info=, r-error=/usr/local/lib64/R/bin/exec/R: error while loading shared libraries: libmkl_gf_lp64.so: cannot open shared object file: No such file or directory|||]; OCCURRED AT: rstudio::core::Error rstudio::core::r_util::rVersion(const rstudio::core::FilePath&, const rstudio::core::FilePath&, const std::string&, std::string*) /root/rstudio/src/cpp/core/r_util/REnvironmentPosix.cpp:784; LOGGED FROM: bool rstudio::core::r_util::detectREnvironment(const rstudio::core::FilePath&, const rstudio::core::FilePath&, const std::string&, std::string*, std::string*, rstudio::core::r_util::EnvironmentVars*, std::string*) /root/rstudio/src/cpp/core/r_util/REnvironmentPosix.cpp:678
我意识到(见下面的答案)只要我没有放松当前的bash环境,R才能工作。执行:
source /opt/intel/mkl/bin/mklvars.sh intel64
解决了这个问题。但是,我无法在启动之前让RStudio执行此操作。我玩ExecStartPre=/opt/intel/mkl/bin/mklvars.sh intel64
,但无法正确启动环境
答案 0 :(得分:1)
在Linux上,RStudio Desktop和Open-Source Server使用Execute for each row
输出所指向的R版本。如果RStudio无法使用哪个R找到R,它将回退到显式扫描/ usr / local / bin和/ usr / bin目录中的R脚本。
如果要覆盖使用哪个版本的R,则可以将which R
环境变量设置为要运行的R可执行文件。例如:
RSTUDIO_WHICH_R
答案 1 :(得分:0)
我手动需要加载
source /opt/intel/mkl/bin/mklvars.sh intel64
进入环境以使R工作,否则链接被破坏而R将无法启动导致RStudio抱怨(并非100%有用的错误消息)。