I am getting the below error trying to deploy my app to gcloud app engine. The whole problem is from trying to add the GDAL library to my app.
File "/opt/python3.7/lib/python3.7/ctypes/init.py", line 377, in getattr func = self.getitem(name) File "/opt/python3.7/lib/python3.7/ctypes/init.py", line 382, in getitem func = self._FuncPtr((name_or_ordinal, self)) AttributeError: /usr/lib/libgdal.so.1: undefined symbol: OGR_F_GetFieldAsInteger64
I followed all the directions I could possibly find online. But nothing seems to work at all. Here is my app.yml files:
runtime: custom
entrypoint: gunicorn -b :8080 app.wsgi
env: flex
# any environment variables you want to pass to your application.
# accessible through os.environ['VARIABLE_NAME']
env_variables:
...
beta_settings:
cloud_sql_instances: site:asia-northeast2:site-db
handlers:
- url: /.*
script: auto
secure: always
manual_scaling:
instances: 1
runtime_config:
python_version: 3
And Dockerfile:
FROM gcr.io/google-appengine/python
#FROM python:3.7
#FROM python:3.8.0-slim-buster
EXPOSE 8080
ENV PYTHONUNBUFFERED 1
# Install GDAL dependencies
#RUN apt-get update && apt-get install --yes libgdal-dev
RUN apt-get update && apt-get install --reinstall -y \
#libopenjp2-7 \
#libopenjp2-7-dev \
#libgdal-dev \
binutils \
gdal-bin \
python-gdal \
python3-gdal
# Update C env vars so compiler can find gdal
#ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
#ENV C_INCLUDE_PATH=/usr/include/gdal
RUN export CPLUS_INCLUDE_PATH=/usr/include/gdal
RUN export C_INCLUDE_PATH=/usr/include/gdal
# 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
# 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.
ADD requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
# Add the application source code.
ADD . /app
# Run a WSGI server to serve the application. gunicorn must be declared as
# a dependency in requirements.txt.
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 main:app --timeout 0 --preload
Someone help me here. What is it I need to do to get this working?
from How to get GDAL to work with Google GCLOUD
No comments:
Post a Comment