【问题标题】:Installing R 3.0.2 in Ubuntu 16.04在 Ubuntu 16.04 中安装 R 3.0.2
【发布时间】:2016-10-05 09:53:39
【问题描述】:

我在尝试在 Ubuntu 16.04 中安装 R 3.0.2 时遇到问题。我尝试添加旧版本 R 的存储库,但在 apt-get 中找不到 R 3.0.2 的包。有没有人尝试在新版本的 Ubuntu 上安装旧版本的 R?我可以知道步骤是什么吗?

我也尝试在 apt-get install 命令中指定版本,但没有找到正确的包。

【问题讨论】:

  • 不安装当前 R 版本是否有特殊原因?
  • 在这里加载并安装它?已经试过了吗? cran.r-project.org/src/base/R-3/R-3.0.2.tar.gz
  • @Roland,是的。我正在使用一个不再兼容的包。它仍在更新中。
  • @J_F,我尝试从头开始安装,但在尝试安装 Rserve 时出现动态库错误。
  • 我可能会寻找有人发布的带有 R 3.0.2 的 docker 容器。快速搜索找到了一个看起来很有希望的。

标签: r ubuntu apt


【解决方案1】:

我认为在你的情况下最好的选择是编译 R。如果你从未做过这样的事情,请在终端中遵循这个小脚本:

# install common R dependencies
sudo apt-get install gcc \ 
                g++ \ 
                gfortran \ 
                bzip2 \ 
                libbz2-dev \ 
                xorg-dev \ 
                liblzma-dev \ 
                libreadline-dev \ 
                libpcre++-dev \ 
                libcurl-dev \ 
                libpango1.0-dev


mkdir R_alternatives
cd R_alternatives
mkdir src
mkdir 3.0.2
cd src
wget https://cran.r-project.org/src/base/R-3/R-3.0.2.tar.gz
tar -xvf R-3.0.2.tar.gz
cd R-3.0.2

#In my opinion is better to compile in one folder (avoid uncompress tar.gz source again, if you get any errors)

mkdir BuildDir
cd BuildDir
# this step will take around 2 minutes
./../configure --with-readline=no --with-x=no --prefix=/home/'user'/R_alternatives/3.0.2
# These two will take longer!!
make
make install

# following the prefix in 'configure' your R libraries are going to be installed in /home/'user'/R_alternatives/3.0.2/lib64/R/library/
# Hence, each time you compile a new R version, it will have its own libraries (this avoid R packages versions problems)
# If you wish more than one library version for the same R version, you must create a new folder and then run
export R_LIBS=/'path_to_your_new_folder'

# If you plan to use this R version in RStudio, you have to edit ~/.bash_profile, therefore you must run:
vi ~/.bash_profile
#or, It is up to you!
gedit ~/.bash_profile

#Then you put this line in end of the file

PATH=/home/'user'/R_alternatives/3.0.2/bin:$PATH
export PATH

# OR...

RSTUDIO_WHICH_R=/home/'user'/R_alternatives/3.0.2/bin/R
export RSTUDIO_WHICH_R

#PS: You can also set the R_LIBS here, in the same way!

【讨论】:

    【解决方案2】:

    首先,请参阅here 了解关于 SO 的类似和较早的问题。

    各种 Ubuntu 版本(主要是 LTS 版本)的旧 R 版本的预编译二进制文件可作为 deb 从以下网站获得:

    https://cran.r-project.org/bin/linux/ubuntu/
    

    不幸的是,似乎不存在用于 xenial 的 R 3.0.2 deb 包;只有精确仍然有 R 3.0.2 包。您可以尝试在 xenial 中安装精确的软件包,但这可能带有它自己的问题集。

    最好按照Facottons 的建议从源代码编译。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-27
      • 1970-01-01
      • 2019-04-12
      • 1970-01-01
      • 2017-04-12
      相关资源
      最近更新 更多