解决Linux平台下R的报错问题
安装BiocManager
install.packages("BiocManager")
加载
library(BiocManager)
安装ggplot2
install.packages("ggplot2")
** byte-compile and prepare package for lazy loading
错误: package ‘cli’ was installed before R 4.0.0: please re-install it
停止执行
ERROR: lazy loading failed for package ‘pillar’
* removing ‘/usr/local/lib/R/site-library/pillar’
ERROR: dependency ‘pillar’ is not available for package ‘tibble’
* removing ‘/usr/local/lib/R/site-library/tibble’
ERROR: dependencies ‘gtable’, ‘tibble’ are not available for package ‘ggplot2’
* removing ‘/usr/local/lib/R/site-library/ggplot2’
下载的程序包在
‘/tmp/Rtmpkm93El/downloaded_packages’里
Warning messages:
1: In install.packages("ggplot2") :
安装程序包‘gtable’时退出狀態的值不是0
2: In install.packages("ggplot2") :
安装程序包‘pillar’时退出狀態的值不是0
3: In install.packages("ggplot2") :
安装程序包‘tibble’时退出狀態的值不是0
4: In install.packages("ggplot2") :
安装程序包‘ggplot2’时退出狀態的值不是0
BiocManager::install("ggplot2")
下载的程序包在
‘/tmp/Rtmpkm93El/downloaded_packages’里
更新'.Library'里的HTML程序包列表
Making 'packages.html' ... 做完了。
Warning messages:
1: In install.packages(...) : 安装程序包‘pillar’时退出狀態的值不是0
2: In install.packages(...) : 安装程序包‘gtable’时退出狀態的值不是0
3: In install.packages(...) : 安装程序包‘tibble’时退出狀態的值不是0
4: In install.packages(...) : 安装程序包‘ggplot2’时退出狀態的值不是0
重新安装一下出现问题的包:没有成功
错误: package ‘cli’ was installed before R 4.0.0: please re-install it
停止执行
ERROR: lazy loading failed for package ‘pillar’
- removing ‘/usr/local/lib/R/site-library/pillar’
ERROR: dependency ‘pillar’ is not available for package ‘tibble’ - removing ‘/usr/local/lib/R/site-library/tibble’
ERROR: dependencies ‘gtable’, ‘tibble’ are not available for package ‘ggplot2’ - removing ‘/usr/local/lib/R/site-library/ggplot2’
install.packages("pillar", "tibble", "gtable")
Warning in install.packages("pillar", "tibble", "gtable") :
'lib="tibble"'不可写
Would you like to use a personal library instead? (yes/No/cancel) yes
Warning: 无法在貯藏處gtable/src/contrib中读写索引:
无法打开URL'gtable/src/contrib/PACKAGES'
Warning message:
package ‘pillar’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
升级R:升级后依旧报错
Ubuntu Packages For R - Brief Instructions
安装二进制包:这个解决方案不适用于linux平台
install.packages("ggplot2", type = "binary")
使用conda安装R
conda create -n r -c r r-essentials
conda activate r
# 安装R包:可以先试试直接在R里面安装
conda install -c r r-ggplot2
install.packages("ggplot2")
library(ggplot2) # 成功