2

I am using anaconda with python 3.7.4 and I am working on VScode. I am currently creating a Flask webapp mostly with bokeh, that I am deploying on google app engine(gcloud). In order to work with GIS I need to install geopandas which will require gdal, fiona, rtree, shapely, pyproj, numpy, among few others. I am working in a virtual environment so I can install the .whl files directly with pip install [file.whl] and it will work locally with no problem. I also created the environment variable for gdal_data and added it to he PATH variable as well. So I have been trying to deploy the app since I installed geopandas and google is trowing me an error of gdal-config not found. I tried to dig into it with my low knowledge with dependencies and deployment. What I figured out was the following:

conda will superseded gdal 3.0.4 and install gdal 2.3.3 pip does not have this version and that when it comes to problem. As long as I understood it google will use my requirements.txt to install the libraries I am using in my virtual environment into their cloud environment, so an error will be thrown once pip will not find the gdal 2.3.3 version that I will pass to my requirements.txt and the one I installed it manually. Also fiona that is one of pillars of the wheel to build GIS plots is not compatible to the gdal version that conda is insisting to superseded.

I have read a lot and spend a good amount of time dealing with this error. There are a lot of info mostly for Linux, but I could not find anything to help me out.

If someone out there could help me that would be appreciated.

davidism
  • 121,510
  • 29
  • 395
  • 339
ReinholdN
  • 526
  • 5
  • 22

1 Answers1

1

I had the same issue when installing gdal:

... main.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config' ...

The problem is that the underlying docker container does not have the required C libraries for running this version of gdal. So you cannot use the default app engine environment for running your application.

The solution is then to create a custom runtime (i.e. docker container) to run your app engine instance. There is another stackoverflow post which explains how to exactly do this.

The most important step is to include:

sudo apt-get install gdal-bin python-gdal
Cloudkollektiv
  • 11,852
  • 3
  • 44
  • 71
  • Thanks man! That was very clarifying, I checked the explanation from the other post, that was good and smart. I am changing my laptop to Linux, windows has been a pain in the neck since I started to deploy apps. I think the fella's solution would work like a charm, I am just not really sure which format his dokerfile would be, I presume .py as it would have an __init__ function. Thanks again. – ReinholdN Feb 19 '20 at 08:34
  • Dockerfiles are named "Dockerfile". Maybe you should research a bit more on how to create a dockerfile, deploy the container to google container registry and then use that container in your app.yaml. I hope this helps, and curious about the final result! – Cloudkollektiv Feb 19 '20 at 09:12