You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 21.04安装r-cran-rstan、r-cran-tidyverse依赖缺失报错

问题现象

Ubuntu 21.04系统完成CRAN R源前期配置、且按c2d4u建议切换为focal源后,安装R包时出现依赖不满足报错,报错信息如下:

> sudo apt install --no-install-recommends r-cran-rstan
Reading package lists... Done
Building dependency tree... Done
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-cran-v8 : Depends: libnode64 but it is not installable
E: Unable to correct problems, you have held broken packages.

> sudo apt install --no-install-recommends r-cran-tidyverse
Reading package lists... Done
Building dependency tree... Done
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-cran-stringi : Depends: libicu66 (>= 66.1-1~) but it is not installable
E: Unable to correct problems, you have held broken packages.
解决步骤
  • 先清理系统持有的损坏包标记,更新源索引,依次执行以下命令:
    sudo apt-mark unhold $(sudo apt-mark showhold)
    sudo apt update && sudo apt upgrade -y
  • 手动安装缺失的低版本依赖:
    1. 安装libnode64依赖:
      curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
      sudo apt install -y nodejs
    2. 安装libicu66依赖:
      wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/icu-devtools_66.1-2ubuntu2_amd64.deb
      wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu66_66.1-2ubuntu2_amd64.deb
      sudo dpkg -i libicu66_66.1-2ubuntu2_amd64.deb icu-devtools_66.1-2ubuntu2_amd64.deb
    3. 修复剩余依赖问题:
      sudo apt --fix-broken install
  • 重新安装目标R包:
    sudo apt install --no-install-recommends r-cran-rstan
    sudo apt install --no-install-recommends r-cran-tidyverse
  • 备选方案(deb安装失败时使用):
    提前安装编译工具链:
    sudo apt install build-essential gfortran libxml2-dev libssl-dev libcurl4-openssl-dev
    进入R交互环境后直接从源码编译安装:
    install.packages("rstan")
    install.packages("tidyverse")

内容的提问来源于stack exchange,提问作者147pm

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.30 07:15:03