gpt4 book ai didi

r - 在 Ubuntu 20.04 上安装 R 的最佳方式?

转载 作者:行者123 更新时间:2023-12-04 02:34:15 25 4
gpt4 key购买 nike

有没有人有在 Ubuntu 20.04 上安装 R 的好方法?我似乎无法通过 apt 找到特定于 20.04 focal 的解决方案。

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal

编辑:通过链接后here并将条目添加到 sources.list,我遇到了依赖性问题:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
r-base : Depends: r-base-core (>= 4.0.2-1.2004.0) but it is not going to be installed
Depends: r-recommended (= 4.0.2-1.2004.0) but it is not going to be installed
Recommends: r-base-html but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

根据@DirkEddelbuettel 的评论,我运行了 sudo apt install r-base-core r-recommended r-base-html 以查看下一级依赖项:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
r-base-core : Depends: libblas3 but it is not installable or
libblas.so.3 but it is not installable
Depends: liblapack3 but it is not installable or
liblapack.so.3 but it is not installable
Depends: libtcl8.6 (>= 8.6.0) but it is not installable
Depends: libtk8.6 (>= 8.6.0) but it is not installable
Recommends: r-base-dev but it is not going to be installed
Recommends: r-doc-html but it is not going to be installed
r-recommended : Depends: r-cran-kernsmooth (>= 2.2.14) but it is not going to be installed
Depends: r-cran-mgcv (>= 1.1.5) but it is not going to be installed
Depends: r-cran-rpart (>= 3.1.20) but it is not going to be installed
Depends: r-cran-survival (>= 2.13.2-1) but it is not going to be installed
Depends: r-cran-matrix but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

当我尝试安装 r-base 时,出现了一个更根本的问题。我最终发现在添加 PPA 后我遇到了未满足的依赖项问题。我使用了这个链接 here解决未满足的依赖关系的潜在问题,这反过来又让我可以进行 apt 安装并且没有任何安装问题。

最佳答案

这是我在 Rocker container r-ubuntu for the 20.04 image 中所做的:

  1. 安装 software-properties-common 可以说 add-apt-repository

  2. 为 R 本身添加 rrutter4.0 PPA(与 CRAN 相同)
    add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0"

  3. 为超过 4k 的 CRAN 包添加 c4d4u.teams 存储库:
    add-apt-repository --enable-source --yes "ppa:c2d4u.team/c2d4u4.0+"

  4. 运行 apt install r-base(以及更多)。

从狭义上讲,您只需要 2 个(因为在完整的 Ubuntu 系统上您可能不需要 1 个)和 4 个,但您也可以使用 3 个。

您当然也可以只使用 docker pull rocker/r-ubuntu:20.04 并获得预制的容器,但我同时使用了两者:一个用于测试的容器,以及我 20.04 上的这些设置机器。

关于r - 在 Ubuntu 20.04 上安装 R 的最佳方式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62597054/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com