DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

RStudio Server 使用 asdf 安装的 R


使用 asdf 安装 R

使用新的 R 3.6.2 版本,为了不影响之前的 3.4.4 版本, 修改 ~/.Renviron 文件, 将用户包目录由 ~/.RPackages 改为 ~/.rPackages/v3.6.2,

asdf 安装 R 3.6.2 报错: error: --with-x=yes (default) and X11 headers/libs are not available

解决方法:

apt install libxt-dev

安装完成后在 /etc/rstudio/rserver.conf 中添加: rsession-which-r=/home/leo/.asdf/installs/R/3.6.2/bin/R

R 3.6.2 使用 ggplot 绘图报缺字体问题

升级到 R 3.6.2 后执行 ggplot 函数报下面的错误:

Couldn’t find font “-adobe-helvetica-medium-r---10-----*-iso8859-1”

解决方法:

sudo apt install x11-xfs-utils xfstt t1-xfree86-nonfree ttf-xfree86-nonfree \
ttf-xfree86-nonfree-syriac xfonts-75dpi xfonts-100dpi

重启后再次运行 R 脚本错误消失。

让 RStudio server 使用 asdf 安装的 R

用 asdf 安装 R 3.6.2 后 RStudio 无法启动, 运行 sudo rstudio-server verify-installation 报 ERROR Unable to find libR.so in expected locations within R Home directory /home/leo/.asdf/installs/R/3.6.2/lib/R。

在 ~/.asdf/installs/R/3.6.2/lib/R 目录下确实没有 libR.so 文件, 手工修改 ~/.asdf/plugins/R/bin/install 文件, 将 install_R 函数里的 make install 改为 make install --enable-R-shlib 发现不是这样用的, 参考 [Building R from source}(https://support.rstudio.com/hc/en-us/articles/218004217-Building-R-from-source) 将 construct_configure_options()最后一句改为: echo "$configure_options --enable-R-shlib", 启动 RStudio Server 成功。



Published

May 6, 2020

Last Updated

May 6, 2020

Category

Tech

Tags

  • asdf 2
  • rstudio 5

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor