【问题标题】:using RStudio with self compiled R使用带有自编译 R 的 RStudio
【发布时间】:2018-07-13 20:35:26
【问题描述】:

如何让 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,但无法正确启动环境

【问题讨论】:

    标签: r rstudio rstudio-server


    【解决方案1】:

    在 Linux 上,RStudio Desktop 和 Open-Source Server 使用 which R 的输出所指向的 R 版本。如果 RStudio 无法使用哪个 R 定位 R,它将回退到显式扫描 /usr/local/bin 和 /usr/bin 目录中的 R 脚本。

    如果您想覆盖使用哪个版本的 R,那么您可以将 RSTUDIO_WHICH_R 环境变量设置为您要运行的 R 可执行文件。例如:

    export RSTUDIO_WHICH_R=/usr/local/bin/R
    

    RStudio Support: Using Different Versions of R

    【讨论】:

    • 这不是修复它。只安装了一个版本的 R。
    • 但作为大纲,它已经通过软链接指向:/bin/R
    • 确实:ln -s /opt/R/${R_VERSION}/bin/R /bin/R 就像在最初的帖子中一样。
    【解决方案2】:

    我需要手动加载

    source /opt/intel/mkl/bin/mklvars.sh intel64
    

    进入 R 工作的环境,否则链接会被破坏并且 R 将无法启动,这会导致 RStudio 抱怨(带有不是 100% 有用的错误消息)。

    【讨论】:

      猜你喜欢
      • 2018-07-26
      • 2017-11-30
      • 2019-02-16
      • 2012-09-27
      • 1970-01-01
      • 2016-10-20
      • 2013-02-09
      • 2021-05-21
      • 1970-01-01
      相关资源
      最近更新 更多