前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用docker镜像测试UCSCXenaShiny在Linux下的安装

使用docker镜像测试UCSCXenaShiny在Linux下的安装

作者头像
王诗翔呀
发布2021-07-16 15:15:27
1.2K0
发布2021-07-16 15:15:27
举报
文章被收录于专栏:优雅R优雅R

主要在Ubuntu 18.04和CentOS 7下进行测试。

Ubuntu

直接使用rocker提供的r镜像。

代码语言:javascript
复制
docker pull r-ubuntu:18.04

https://github.com/rocker-org/rocker/tree/master/r-ubuntu[1]

启动和进入镜像:

代码语言:javascript
复制
docker run --name ubuntu -it rocker/r-ubuntu:18.04 /bin/bash

进入R,然后安装CRAN包的安装方式进行安装。

一些包安装失败:

代码语言:javascript
复制
Warning messages:
1: In install.packages("UCSCXenaShiny") :
  installation of package ‘curl’ had non-zero exit status
2: In install.packages("UCSCXenaShiny") :
  installation of package ‘openssl’ had non-zero exit status
3: In install.packages("UCSCXenaShiny") :
  installation of package ‘httr’ had non-zero exit status
4: In install.packages("UCSCXenaShiny") :
  installation of package ‘UCSCXenaTools’ had non-zero exit status
5: In install.packages("UCSCXenaShiny") :
  installation of package ‘rio’ had non-zero exit status
6: In install.packages("UCSCXenaShiny") :
  installation of package ‘car’ had non-zero exit status
7: In install.packages("UCSCXenaShiny") :
  installation of package ‘rstatix’ had non-zero exit status
8: In install.packages("UCSCXenaShiny") :
  installation of package ‘ggpubr’ had non-zero exit status
9: In install.packages("UCSCXenaShiny") :
  installation of package ‘UCSCXenaShiny’ had non-zero exit status

逐一测试下问题。

安装curl包问题:

代码语言:javascript
复制
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
 * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
 * rpm: libcurl-devel (Fedora, CentOS, RHEL)
 * csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------

安装curl的依赖:

代码语言:javascript
复制
apt update
apt install libcurl4-openssl-dev 

安装openssl包问题:

代码语言:javascript
复制
--------------------------- [ANTICONF] --------------------------------
Configuration failed because openssl was not found. Try installing:
 * deb: libssl-dev (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: openssl@1.1 (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
tools/version.c:1:10: fatal error: openssl/opensslv.h: No such file or directory
 #include <openssl/opensslv.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
--------------------------------------------------------------------

安装依赖:

代码语言:javascript
复制
apt install libssl-dev

安装UCSCXenaShiny成功后,进一步关注App启动时的依赖安装。

xml2包安装失败:

代码语言:javascript
复制
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
 * deb: libxml2-dev (Debian, Ubuntu, etc)
 * rpm: libxml2-devel (Fedora, CentOS, RHEL)
 * csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘xml2’
代码语言:javascript
复制
apt install libxml2-dev

ERROR: dependencies ‘gmp’, ‘Rmpfr’ are not available for package ‘PMCMRplus’

代码语言:javascript
复制
apt install libgmp3-dev
apt install libmpfr-dev 

错误there is no package called ‘shinythemes’

代码语言:javascript
复制
install.packages("shinythemes")

CentOS

参考 https://github.com/jlisic/R-docker-centos/blob/master/centos-7-epel/Dockerfile[2] 处的Dockerfile文件先配置CentOS下的R环境。

代码语言:javascript
复制
docker pull centos:centos7
docker run -it --name centos7 centos:centos7 

# set up EPEL
yum -y install epel-release 
yum -y update 

# set locales
echo "LANG=en_US.utf8" >> /etc/locale.conf
localedef -c -f UTF-8 -i en_US en_US.UTF-8 
export LC_ALL=en_US.UTF-8 

# install R
yum -y install R-core R-core-devel R-java R-cpp openssl-devel libcurl-devel \
  && echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "libcurl")' >> /usr/lib64/R/etc/Rprofile.site

类似Ubuntu,直接用CRAN方式安装。

根据上面 Ubuntu 的经验将一些依赖库装好。

代码语言:javascript
复制
yum update && yum install -y libcurl-devel openssl-devel libxml2-devel 

安装 nloptr 报错。原因是最新版本仅支持 R≥4.0(测试使用的3.6)。

代码语言:javascript
复制
libtool: link: ERROR: no information for variable 'AR' cru 

参考 https://stackoverflow.com/questions/62900525/install-lme4-from-cran-on-ubuntu[3] 安装较低版本解决:

代码语言:javascript
复制
packageurl <- "https://cran.r-project.org/src/contrib/Archive/nloptr/nloptr_1.2.1.tar.gz"

install.packages(packageurl, repos=NULL, type="source")

启动时报错 package ‘pacman’ is not available (for R version 3.6.0)

代码语言:javascript
复制
install.packages("pacman")

ERROR: dependencies ‘gmp’, ‘Rmpfr’ are not available for package ‘PMCMRplus’

代码语言:javascript
复制
yum install install gmp-devel
yum install mpfr-devel 

安装 jpeg 报错。

代码语言:javascript
复制
yum install libjpeg-devel 

grid-renderer.h:61:94: error: no matching function for call to ‘Rcpp::Vector<10, Rcpp::PreserveStorage>::Vector(int, bool&, const GraphicsContext&)’

代码语言:javascript
复制
yum install cairo-devel

还是不行,参考 https://stackoverflow.com/questions/63962253/problem-compiling-the-´gridtext´-package-in-r[4] 调整 C++ 版本。

代码语言:javascript
复制
yum install centos-release-scl
yum install devtoolset-9
# If you use your non-root account to install packages, 
# change /root to /home/your_id in the following command
mkdir -p /root/.R
vi /root/.R/Makevars 

在文件中加入内容:

代码语言:javascript
复制
CXX11=/opt/rh/devtoolset-9/root/usr/bin/g++ -std=c++11

其他

有意思的是我发现在安装后对容器大小进行查看,发现centos7差不多是ubuntu的2倍。

代码语言:javascript
复制
[root@VM-0-5-centos ~]# docker container ls -sa


CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS                          PORTS               NAMES               SIZE
5197b616d026        centos:centos7               "/bin/bash"         3 hours ago         Exited (0) About a minute ago                       centos7             2.27GB (virtual 2.47GB)
be2edf9620e7        rocker/r-ubuntu:18.04        "/bin/bash"         4 hours ago         Exited (0) 55 seconds ago                           ubuntu              651MB (virtual 1.26GB)

参考资料

[1]

https://github.com/rocker-org/rocker/tree/master/r-ubuntu: https://github.com/rocker-org/rocker/tree/master/r-ubuntu

[2]

https://github.com/jlisic/R-docker-centos/blob/master/centos-7-epel/Dockerfile: https://github.com/jlisic/R-docker-centos/blob/master/centos-7-epel/Dockerfile

[3]

https://stackoverflow.com/questions/62900525/install-lme4-from-cran-on-ubuntu: https://stackoverflow.com/questions/62900525/install-lme4-from-cran-on-ubuntu

[4]

https://stackoverflow.com/questions/63962253/problem-compiling-the-´gridtext´-package-in-r: https://stackoverflow.com/questions/63962253/problem-compiling-the-´gridtext´-package-in-r

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2021-07-09,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 优雅R 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Ubuntu
  • CentOS
  • 其他
    • 参考资料
    相关产品与服务
    容器服务
    腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档