JupyterR内核在Seurat及依赖包安装时,Error: C++17 standard requested but CXX17 is not defined各种报错问题及解决方案

文章目录

    • 1 前言
    • 2 报错类型及解决方案
      • 2.1 “安装程序包‘RcppArmadillo’时退出狀態的值不是0”
      • 2.2 package ‘reticule’ is not available for Bioconductor version '3.15'
      • 2.3 Error: C++17 standard requested but CXX17 is not defined
      • 2.4 /usr/bin/ld: cannot find -lgfortran collect2: error: ld returned 1 exit status

1 前言

这几天需要跑单细胞的数据,单位服务器只有Python的内核,搭建完R内核后开始装R包,第一个:Seurat就开始各种报错,记录大战三百回合。笔者倔起来就是肝,坚决不docker,就是要搞。报错的起因是Error: C++17 standard requested but CXX17 is not defined本篇顺带记录其他相关报错,下文一一细说,排序无先后主次之分。
JupyterR内核在Seurat及依赖包安装时,Error: C++17 standard requested but CXX17 is not defined各种报错问题及解决方案_第1张图片

2 报错类型及解决方案

2.1 “安装程序包‘RcppArmadillo’时退出狀態的值不是0”

  1. 这类报错提示很泛,各种原因都有可能,最常见能解决的就是一个一个安装依赖包,将这些报错的包名称在R包官网列表里找到,安装对应的报错包的依赖包
  2. 再不济,就下载对应的压缩包,选择一一本地安装,这里是在Rstudio server内进行的,

JupyterR内核在Seurat及依赖包安装时,Error: C++17 standard requested but CXX17 is not defined各种报错问题及解决方案_第2张图片
JupyterR内核在Seurat及依赖包安装时,Error: C++17 standard requested but CXX17 is not defined各种报错问题及解决方案_第3张图片

2.2 package ‘reticule’ is not available for Bioconductor version ‘3.15’

Bioconductor版本3.15,R4.2后要安装3.16,安装新版本即可

if (!require("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install(version = "3.16")

###安装全部
Upgrade 36 packages to Bioconductor version '3.16'? [y/n]: 
y

然后就来新的包安装报错了,再继续一一安装解决,这个就是重复且机械的活。R实在太薛定谔了,除了个别明星报错,这种大类的很泛的报错,指不定现在安装不行,过两天明天安装又行了;别人的电脑可以,自己的电脑不行(多半是路径安装目录,环境配置),所以只能一个一个试,来一个解决一个,来一群解决一群

> warnings()
Warning messages:
1: In install.packages(...) :
  installation of package ‘httpuv’ had non-zero exit status
2: In install.packages(...) :
  installation of package ‘impute’ had non-zero exit status
3: In install.packages(...) :
  installation of package ‘preprocessCore’ had non-zero exit status
4: In install.packages(...) :
  installation of package ‘cluster’ had non-zero exit status
5: In install.packages(...) :
  installation of package ‘stringi’ had non-zero exit status
6: In install.packages(...) :
  installation of package ‘Matrix’ had non-zero exit status
7: In install.packages(...) :
  installation of package ‘nlme’ had non-zero exit status
8: In install.packages(...) :
  installation of package ‘RcppEigen’ had non-zero exit status
9: In install.packages(...) :
  installation of package ‘mgcv’ had non-zero exit status
10: In install.packages(...) :
  installation of package ‘Biostrings’ had non-zero exit status
11: In install.packages(...) :
  installation of package ‘interp’ had non-zero exit status

2.3 Error: C++17 standard requested but CXX17 is not defined

这个是GCC版本问题,设置一下用新版本就行了,这个在终端运行,立竿见影

module load GCC/7.2.0-2.29
然后:
mkdir -p ~/.R
  echo 'CXX17 = g++ -std=c++17 -fPIC' > ~/.R/Makevars

JupyterR内核在Seurat及依赖包安装时,Error: C++17 standard requested but CXX17 is not defined各种报错问题及解决方案_第4张图片

2.4 /usr/bin/ld: cannot find -lgfortran collect2: error: ld returned 1 exit status

还是gcc的问题

# 在终端运行,把ld换成自己报错时的路径
ldconfig -p | grep ld
which ld

# 更新
sudo yum update

# 查看版本
gcc --version
gfortran --version

# 重新安装一次就行了
sudo yum install gcc-gfortran 

JupyterR内核在Seurat及依赖包安装时,Error: C++17 standard requested but CXX17 is not defined各种报错问题及解决方案_第5张图片

你可能感兴趣的:(R生信,Linux,c++,python,开发语言)