App Engine Flexible-Docker文件无法安装GDAL

问题描述 投票:0回答:1

我正在尝试将Django应用程序部署到App Engine灵活环境。我的dockerfile无法安装GDAL。

这是我在运行gcloud app deploy时收到的错误消息:

  File "/env/lib/python3.7/site-packages/django/contrib/gis/gdal/libgdal.py", line 42, in <module>
    % '", "'.join(lib_names)
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal2.4.0", "gdal2.3.0", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
[2020-04-24 16:12:26 +0000] [8] [INFO] Worker exiting (pid: 8)
[2020-04-24 16:12:26 +0000] [1] [INFO] Shutting down: Master
[2020-04-24 16:12:26 +0000] [1] [INFO] Reason: Worker failed to boot.

这是我的dockerfile:

FROM ubuntu:bionic

RUN apt-get update && apt-get install -y \
  binutils \
  gdal-bin \
  python3-gdal \
  ibgdal-dev \
  libproj-dev

# Create a virtualenv for dependencies. This isolates these packages from
# system-level packages.
# Use -p python3 or -p python3.7 to select python version. Default is version 2.
RUN virtualenv /env -p python3.7



# Setting these environment variables are the same as running
# source /env/bin/activate.
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH

# Copy the application's requirements.txt and run pip to install all
# dependencies into the virtualenv.
RUN pip install -r requirements.txt

# Add the application source code.
ADD . /


# Run a WSGI server to serve the application. gunicorn must be declared as
# a dependency in requirements.txt.
CMD gunicorn -b :$PORT main:app

这是我的app.yaml:

runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app

runtime_config:
  # You can also specify 2 for Python 2.7
  python_version: 3.7

[我知道我在问一个非常相似的问题,here,但发问者自己的解决方案似乎无效。

docker google-app-engine dockerfile gdal
1个回答
0
投票

我认为问题出在Docker文件中。您具有以下内容:

...
RUN apt-get update && apt-get install -y \
  binutils \
  gdal-bin \
  python3-gdal \
  ibgdal-dev \
  libproj-dev
....

而且我认为库的名称是libgdal-dev而不是libgdal-dev

© www.soinside.com 2019 - 2024. All rights reserved.