简体   繁体   English

Heroku、R 和 Gdal

[英]Heroku, R and Gdal

So my app suddenly stopped working and after investigation it seems that the problem came from the fact that leaflet wasn't being installed correctly when the app was being deployed and this was due to the fact that basically Heroku does not support gdal.所以我的应用程序突然停止工作,经过调查,问题似乎来自leaflet在部署应用程序时没有正确安装,这是因为基本上Heroku不支持gdal。 The error I was getting while the app was being built was checking for gdal-config... no .我在构建应用程序时遇到的错误是checking for gdal-config... no

I went to the GitHub of the R buildpack ( https://github.com/virtualstaticvoid/heroku-buildpack-r ) and it said I need to containerize the app, so I did.我去了R buildpack( https://github.com/virtualstaticvoid/heroku-buildpack-r )的GitHub,它说我需要容器,所以我需要容器

I did what was said in the following link ( https://github.com/virtualstaticvoid/heroku-docker-r ) and in my dockerfile I added some comands so my docker file looks like this:我做了以下链接( https://github.com/virtualstaticvoid/heroku-docker-r )中所说的,在我的 dockerfile 我添加了一些命令,所以我的 Z05B6053C41A2130AFD6FC3B 文件看起来像这样:

FROM virtualstaticvoid/heroku-docker-r:shiny
ENV PORT=8080
RUN apt-get update &&\
    apt-get install -y libcurl4-openssl-dev libssl-dev binutils libproj-dev proj-bin libgdal-dev gdal-bin
CMD ["/usr/bin/R", "--no-save", "--gui-none", "-f", "/app/run.R"]

Sadly, I still get the same error.可悲的是,我仍然遇到同样的错误。 Furthermore I cannot download the openssl module and I have no idea how to implement/try the handful of answers I found online:此外,我无法下载 openssl 模块,我不知道如何实施/尝试我在网上找到的少数答案:

Using PKG_CFLAGS=
--------------------------- [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
    1 | #include <openssl/opensslv.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

I need help please.我需要帮助。

EDIT:编辑:

I think that the problem comes from the fact that I am istalling the libraries after building the image from docker (this image installs R without installing the libgdal, gdal-config,... packages) so these need to be installed before the FROM statement or I need to build an image of my own (no idea how to) or the person needs to do update his image so that it supports gdal and openssl.我认为问题来自这样一个事实,即我在从 docker 构建映像之后安装库(此映像安装 R 而不安装 libgdal、gdal-config、... 包),因此需要在 FROM 语句之前安装这些或者我需要建立自己的图像(不知道如何),或者这个人需要更新他的图像,以便它支持 gdal 和 openssl。

As you guessed, the issue is that the libgdal-dev dependency isn't installed prior to the rgdal R package being installed.正如您所猜测的那样,问题是在安装rgdal R package 之前没有安装libgdal-dev依赖项。

heroku-docker-r makes provision for this with an "Aptfile" to specify dependencies to be installed (as per Applications with Additional Dependencies in the documentation). heroku-docker-r为此提供了一个“Aptfile”来指定要安装的依赖项(根据文档中具有附加依赖项的应用程序)。

I've created an example project, heroku-docker-r-rgdal-example to show how to structure the project with the required files etc.我创建了一个示例项目heroku-docker-r-rgdal-example来展示如何使用所需文件等构建项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM