r - 安装AWS S3 R包

标签 r amazon-web-services amazon-s3

我正在尝试在 R 上安装 S3 包,以便保存我正在运行的回归的 csv 输出。我尝试安装 S3 软件包以将 Rstudio 服务器链接到 S3,但没有成功。这是我在尝试安装 aws.s3 包时收到的错误:

> install.packages("aws.s3", repos = c("cloudyr" = "http://cloudyr.github.io/drat"))
Installing package into ‘/home/jessica/R/x86_64-redhat-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependency ‘httr’ is not available
trying URL 'http://cloudyr.github.io/drat/src/contrib/aws.s3_0.3.20.tar.gz'
Content type 'application/gzip' length 47438 bytes (46 KB)
==================================================
downloaded 46 KB

ERROR: dependency ‘httr’ is not available for package ‘aws.s3’
* removing ‘/home/jessica/R/x86_64-redhat-linux-gnu-library/3.4/aws.s3’
Warning in install.packages :
  installation of package ‘aws.s3’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpxNVUj5/downloaded_packages’

然后我尝试安装 httr 依赖包,但也没有成功。

> install.packages("httr")
Installing package into ‘/home/jessica/R/x86_64-redhat-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependency ‘openssl’

trying URL 'https://cran.rstudio.com/src/contrib/openssl_1.3.tar.gz'
Content type 'application/x-gzip' length 1218896 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/src/contrib/httr_1.4.0.tar.gz'
Content type 'application/x-gzip' length 156356 bytes (152 KB)
==================================================
downloaded 152 KB

* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=
------------------------- ANTICONF ERROR ---------------------------
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: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="244b54414a57574864150a15" rel="noreferrer noopener nofollow">[email protected]</a> (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: configuration failed for package ‘openssl’
* removing ‘/home/jessica/R/x86_64-redhat-linux-gnu-library/3.4/openssl’
Warning in install.packages :
  installation of package ‘openssl’ had non-zero exit status
ERROR: dependency ‘openssl’ is not available for package ‘httr’
* removing ‘/home/jessica/R/x86_64-redhat-linux-gnu-library/3.4/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpxNVUj5/downloaded_packages’

安装 openssl 软件包时也是如此。我的 EC2 实例类型是 t2.medium。

最佳答案

这里,在安装cloudyr的aws.s3包之前,需要一些操作系统和一些R依赖项。

aws.s3 依赖于三个 R 包:curlhttrxml。这些又依赖于 libssllibxml2libcurl4-openssl 操作系统库。

在一个全新的 EC2 实例上,假设是 Ubuntu 机器(当然,Fedora/CentOS/RedHat 发行版也有等效的 yum 软件包),必须首先安装操作系统依赖项:

sudo apt-get install -y build-essential libssl-dev libxml2-dev libcurl4-openssl-dev

然后您可以按照指定的顺序安装以下 R 软件包:

install.packages('curl')
install.packages('httr')
install.packages('xml2')
install.packages("aws.s3", repos = c("cloudyr" = "http://cloudyr.github.io/drat"))

希望这有帮助

关于r - 安装AWS S3 R包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55855898/

相关文章:

java - 使用 JMeter 对 1000 个用户进行负载测试时出现 Apache Tomcat Connection Refused 错误

r - 如何在不重复预定义三元组中的特定元素的情况下随机化向量?

regex - R正则表达式

r - 如何在 DT 的左侧有一个像 Excel 中那样的行号?

r - 使用列表中的两个按行参数分割/过滤数据框

amazon-web-services - 如何在 docker 的 keycloak 中添加 SSL

regex - 如何正则表达式匹配包含 AWS 安全组 ID 的逗号分隔列表?

amazon-web-services - webpack 拆分是否有利于节省 AWS 成本?

amazon-s3 - AWS S3 提供的 CORS header 不一致

ruby-on-rails - 获取不会过期的永久 amazon s3 对象 url