随笔1215 docker r+python

遍地的坑啊

 

目标 搭建docker sparkR

小目标 rpy2 fbprophet python3

 

坑1:

rpy2 如果要求python支持 需要 R

解决方案:去下载r

 

坑2:

ubuntu的不能下载latest 版本的 R 如果直接 

apt-get update
apt-get install r-base

  

会直接下载到3.1.1 而python3下的 rpy2要求 R -version >= 3.3.x

解决方案:https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-16-04-2

 

坑3:

gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
gpg: key E084DAB9: public key "Michael Rutter <marutter@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
/bin/sh: 1: add-apt-repository: not found

add-apt-repository 无效

 

解决方案:依赖问题 先运行 apt-get update

 

坑4:

gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
gpg: key E084DAB9: public key "Michael Rutter <marutter@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists...
E: The method driver /usr/lib/apt/methods/https could not be found.
E: Failed to fetch https://cran.rstudio.com/bin/linux/ubuntu/xenial/InRelease
E: Some index files failed to download. They have been ignored, or old ones used instead.

  

解决方案:待解决

 

branch1:

尝试直接加入key之后下载r

FROM ubuntu
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 \
 && apt-get update \
 && apt-get install -y  r-base r-base-dev

  

这个是最新的稳定版本 3.2.3显然不符合标准。。。

 

branch2:

尝试 这样的 Dockerfile

FROM ubuntu
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 \
 && apt-get update \
 && apt-get install -y software-properties-common \
 && add-apt-repository ppa:marutter/rdev \
 && apt-get install -y  r-base r-base-dev

  

还是 3.2.3版本。。。

话说运维的活 感觉一天一天都在编译失败中读过 那是多么绝望又痛苦的生活啊

 

 

解决方案:https://store.docker.com/community/images/rpy2/rpy2/dockerfile

 

installing to /usr/local/lib/R/site-library/tidyr/libs
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (tidyr)
* installing *source* package 'broom' ...
** package 'broom' successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (broom)
ERROR: dependency 'rstan' is not available for package 'prophet'
* removing '/usr/local/lib/R/site-library/prophet'

The downloaded source packages are in
	'/tmp/RtmpStr88P/downloaded_packages'
Warning messages:
1: package 'forcast' is not available (for R version 3.4.3)
2: In install.packages(sub("(.+)\\\\n", "\\1", scan("rpacks.txt", "character")),  :
  installation of package 'rstan' had non-zero exit status
3: In install.packages(sub("(.+)\\\\n", "\\1", scan("rpacks.txt", "character")),  :
  installation of package 'prophet' had non-zero exit status

  

 

r包 prophet会 install failure 原因在于rstan失败

一直看到ssl错误以为是网路或者mirror的问题

结果发现是路径错误

感谢大佬

https://github.com/stan-dev/rstan/issues/175

不说了心累

posted @ 2017-12-15 11:32  宇佐见莲子  阅读(338)  评论(0)    收藏  举报