2
votes

I'm trying to deploy a geodjango application on AWS Elastic Beanstalk. The configuration is 64bit Amazon Linux 2017.09 v2.6.6 running Python 3.6. I am getting this error when trying to deploy:

Requires: libpoppler.so.5()(64bit) Error: Package: gdal-java-1.9.2-8.rhel6.x86_64 (pgdg93) Requires: libpoppler.so.5()(64bit)

How do I install the required package? I read through Setting up Django with GeoDjango Support in AWS Beanstalk or EC2 Instance but I am still getting problems. My ebextensions currently looks like:

commands:
  01_yum_update:
  command: sudo yum -y update
02_epel_repo:
  command: sudo yum-config-manager -y --enable epel
03_install_gdal_packages:
  command: sudo yum -y install gdal gdal-devel

packages:
  yum:
     git: []
     postgresql95-devel: []
     gettext: []
     libjpeg-turbo-devel: []
     libffi-devel: []
1
I think adding poppler-devel.x86_64 to the list of package in the above .ebextensions file should do it. If that doesn't work, try one of the other packages returned by yum search poppler.progfan

1 Answers

9
votes

I'm going to answer my own question for the sake my future projects and anyone else trying to get started with geodjango. Updating this answer as of July 2020

Create an ebextensions file to install GDAL on the EC2 instance at deployment:

01_gdal.config

commands:
  01_install_gdal:
    test: "[ ! -d /usr/local/gdal ]"
    command: "/tmp/gdal_install.sh"
files:
  "/tmp/gdal_install.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      sudo yum-config-manager --enable epel
      sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel

      # Geos
      cd /
      sudo mkdir -p /usr/local/geos
      cd usr/local/geos/geos-3.7.2
      sudo wget geos-3.7.2.tar.bz2 http://download.osgeo.org/geos/geos-3.7.2.tar.bz2
      sudo tar -xvf geos-3.7.2.tar.bz2
      cd geos-3.7.2
      sudo ./configure
      sudo make
      sudo make install
      sudo ldconfig

      # Proj4
      cd /
      sudo mkdir -p /usr/local/proj
      cd usr/local/proj
      sudo wget -O proj-5.2.0.tar.gz http://download.osgeo.org/proj/proj-5.2.0.tar.gz
      sudo wget -O proj-datumgrid-1.8.tar.gz http://download.osgeo.org/proj/proj-datumgrid-1.8.tar.gz
      sudo tar xvf proj-5.2.0.tar.gz
      sudo tar xvf proj-datumgrid-1.8.tar.gz
      cd proj-5.2.0
      sudo ./configure
      sudo make
      sudo make install
      sudo ldconfig

      # GDAL
      cd /
      sudo mkdir -p /usr/local/gdal
      cd usr/local/gdal
      sudo wget -O gdal-2.4.4.tar.gz http://download.osgeo.org/gdal/2.4.4/gdal-2.4.4.tar.gz
      sudo tar xvf gdal-2.4.4.tar.gz
      cd gdal-2.4.4
      sudo ./configure
      sudo make
      sudo make install
      sudo ldconfig

As shown, the script checks whether gdal already exists using the test function. It then downloads the Geos, Proj, and GDAL libraries and installs them in the usr/local directory. At the time of writing this, geodjango (Django 3.0) supports up to Geos 3.7, Proj 5.2 (which also requires projdatum. Current releases do not require it), and GDAL 2.4 Warning: this installation process can take a long time. Also I am not a Linux professional so some of those commands may be redundant, but it works.

Lastly I add the following two environment variables to my Elastic Beanstalk configuration:

LD_LIBRARY_PATH: /usr/local/lib:$LD_LIBRARY_PATH
PROJ_LIB: usr/local/proj

If you still have troubles I recommend checking the logs and ssh-ing in the EC2 instance to check that installation took place. Original credit to this post