django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library












3















I'm trying to use gis in the docker:



This is Dockerfile of django:



FROM python:3.6-alpine

ENV PYTHONUNBUFFERED 1

RUN apk update
# psycopg2 dependencies
&& apk add --virtual build-deps gcc python3-dev musl-dev
&& apk add postgresql-dev
# Pillow dependencies
&& apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev
# CFFI dependencies
&& apk add libffi-dev py-cffi
# Translations dependencies
&& apk add gettext
# https://docs.djangoproject.com/en/dev/ref/django-admin/#dbshell
&& apk add postgresql-client


# ADD PostGIS here
# POSTGIS dependencies
ENV POSTGIS_VERSION 2.4.4
ENV POSTGIS_SHA256 0dff4902556ad45430e2b85dbe7e9baa758c6eb0bfd5ff6948f478beddd56b67


RUN set -ex

&& apk add --no-cache --virtual .fetch-deps
ca-certificates
openssl
tar

&& wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz"
&& echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c -
&& mkdir -p /usr/src/postgis
&& tar
--extract
--file postgis.tar.gz
--directory /usr/src/postgis
--strip-components 1
&& rm postgis.tar.gz

&& apk add --no-cache --virtual .build-deps
autoconf
automake
g++
json-c-dev
libtool
libxml2-dev
make
perl

# add libcrypto from (edge:main) for gdal-2.3.0
&& apk add --no-cache --virtual .crypto-rundeps
--repository http://dl-cdn.alpinelinux.org/alpine/edge/main
libressl2.7-libcrypto
&& apk add --no-cache --virtual .build-deps-testing
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing
gdal-dev
geos-dev
proj4-dev
protobuf-c-dev
&& cd /usr/src/postgis
&& ./autogen.sh
# configure options taken from:
# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
&& ./configure
# --with-gui
&& make
&& make install
&& apk add --no-cache --virtual .postgis-rundeps
json-c
&& apk add --no-cache --virtual .postgis-rundeps-testing
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing
geos
gdal
py-gdal
proj4
protobuf-c
&& cd /
&& rm -rf /usr/src/postgis
&& apk del .fetch-deps .build-deps .build-deps-testing
# && apk del .fetch-deps .build-deps .build-deps-testing
# END POSTGIS Changes


# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt

COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/r//' /entrypoint
RUN chmod +x /entrypoint

COPY ./compose/local/django/start /start
RUN sed -i 's/r//' /start
RUN chmod +x /start

COPY ./compose/local/django/celery/worker/start /start-celeryworker
RUN sed -i 's/r//' /start-celeryworker
RUN chmod +x /start-celeryworker

COPY ./compose/local/django/celery/beat/start /start-celerybeat
RUN sed -i 's/r//' /start-celerybeat
RUN chmod +x /start-celerybeat

COPY ./compose/local/django/celery/flower/start /start-flower
RUN sed -i 's/r//' /start-flower
RUN chmod +x /start-flower

WORKDIR /app

ENTRYPOINT ["/entrypoint"]


This is my Dockerfile of postgres:



FROM mdillon/postgis 

COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
RUN chmod +x /usr/local/bin/maintenance/*
RUN mv /usr/local/bin/maintenance/* /usr/local/bin
&& rmdir /usr/local/bin/maintenance


What am I doing wrong?










share|improve this question



























    3















    I'm trying to use gis in the docker:



    This is Dockerfile of django:



    FROM python:3.6-alpine

    ENV PYTHONUNBUFFERED 1

    RUN apk update
    # psycopg2 dependencies
    && apk add --virtual build-deps gcc python3-dev musl-dev
    && apk add postgresql-dev
    # Pillow dependencies
    && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev
    # CFFI dependencies
    && apk add libffi-dev py-cffi
    # Translations dependencies
    && apk add gettext
    # https://docs.djangoproject.com/en/dev/ref/django-admin/#dbshell
    && apk add postgresql-client


    # ADD PostGIS here
    # POSTGIS dependencies
    ENV POSTGIS_VERSION 2.4.4
    ENV POSTGIS_SHA256 0dff4902556ad45430e2b85dbe7e9baa758c6eb0bfd5ff6948f478beddd56b67


    RUN set -ex

    && apk add --no-cache --virtual .fetch-deps
    ca-certificates
    openssl
    tar

    && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz"
    && echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c -
    && mkdir -p /usr/src/postgis
    && tar
    --extract
    --file postgis.tar.gz
    --directory /usr/src/postgis
    --strip-components 1
    && rm postgis.tar.gz

    && apk add --no-cache --virtual .build-deps
    autoconf
    automake
    g++
    json-c-dev
    libtool
    libxml2-dev
    make
    perl

    # add libcrypto from (edge:main) for gdal-2.3.0
    && apk add --no-cache --virtual .crypto-rundeps
    --repository http://dl-cdn.alpinelinux.org/alpine/edge/main
    libressl2.7-libcrypto
    && apk add --no-cache --virtual .build-deps-testing
    --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing
    gdal-dev
    geos-dev
    proj4-dev
    protobuf-c-dev
    && cd /usr/src/postgis
    && ./autogen.sh
    # configure options taken from:
    # https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
    && ./configure
    # --with-gui
    && make
    && make install
    && apk add --no-cache --virtual .postgis-rundeps
    json-c
    && apk add --no-cache --virtual .postgis-rundeps-testing
    --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing
    geos
    gdal
    py-gdal
    proj4
    protobuf-c
    && cd /
    && rm -rf /usr/src/postgis
    && apk del .fetch-deps .build-deps .build-deps-testing
    # && apk del .fetch-deps .build-deps .build-deps-testing
    # END POSTGIS Changes


    # Requirements are installed here to ensure they will be cached.
    COPY ./requirements /requirements
    RUN pip install -r /requirements/local.txt

    COPY ./compose/production/django/entrypoint /entrypoint
    RUN sed -i 's/r//' /entrypoint
    RUN chmod +x /entrypoint

    COPY ./compose/local/django/start /start
    RUN sed -i 's/r//' /start
    RUN chmod +x /start

    COPY ./compose/local/django/celery/worker/start /start-celeryworker
    RUN sed -i 's/r//' /start-celeryworker
    RUN chmod +x /start-celeryworker

    COPY ./compose/local/django/celery/beat/start /start-celerybeat
    RUN sed -i 's/r//' /start-celerybeat
    RUN chmod +x /start-celerybeat

    COPY ./compose/local/django/celery/flower/start /start-flower
    RUN sed -i 's/r//' /start-flower
    RUN chmod +x /start-flower

    WORKDIR /app

    ENTRYPOINT ["/entrypoint"]


    This is my Dockerfile of postgres:



    FROM mdillon/postgis 

    COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
    RUN chmod +x /usr/local/bin/maintenance/*
    RUN mv /usr/local/bin/maintenance/* /usr/local/bin
    && rmdir /usr/local/bin/maintenance


    What am I doing wrong?










    share|improve this question

























      3












      3








      3


      1






      I'm trying to use gis in the docker:



      This is Dockerfile of django:



      FROM python:3.6-alpine

      ENV PYTHONUNBUFFERED 1

      RUN apk update
      # psycopg2 dependencies
      && apk add --virtual build-deps gcc python3-dev musl-dev
      && apk add postgresql-dev
      # Pillow dependencies
      && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev
      # CFFI dependencies
      && apk add libffi-dev py-cffi
      # Translations dependencies
      && apk add gettext
      # https://docs.djangoproject.com/en/dev/ref/django-admin/#dbshell
      && apk add postgresql-client


      # ADD PostGIS here
      # POSTGIS dependencies
      ENV POSTGIS_VERSION 2.4.4
      ENV POSTGIS_SHA256 0dff4902556ad45430e2b85dbe7e9baa758c6eb0bfd5ff6948f478beddd56b67


      RUN set -ex

      && apk add --no-cache --virtual .fetch-deps
      ca-certificates
      openssl
      tar

      && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz"
      && echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c -
      && mkdir -p /usr/src/postgis
      && tar
      --extract
      --file postgis.tar.gz
      --directory /usr/src/postgis
      --strip-components 1
      && rm postgis.tar.gz

      && apk add --no-cache --virtual .build-deps
      autoconf
      automake
      g++
      json-c-dev
      libtool
      libxml2-dev
      make
      perl

      # add libcrypto from (edge:main) for gdal-2.3.0
      && apk add --no-cache --virtual .crypto-rundeps
      --repository http://dl-cdn.alpinelinux.org/alpine/edge/main
      libressl2.7-libcrypto
      && apk add --no-cache --virtual .build-deps-testing
      --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing
      gdal-dev
      geos-dev
      proj4-dev
      protobuf-c-dev
      && cd /usr/src/postgis
      && ./autogen.sh
      # configure options taken from:
      # https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
      && ./configure
      # --with-gui
      && make
      && make install
      && apk add --no-cache --virtual .postgis-rundeps
      json-c
      && apk add --no-cache --virtual .postgis-rundeps-testing
      --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing
      geos
      gdal
      py-gdal
      proj4
      protobuf-c
      && cd /
      && rm -rf /usr/src/postgis
      && apk del .fetch-deps .build-deps .build-deps-testing
      # && apk del .fetch-deps .build-deps .build-deps-testing
      # END POSTGIS Changes


      # Requirements are installed here to ensure they will be cached.
      COPY ./requirements /requirements
      RUN pip install -r /requirements/local.txt

      COPY ./compose/production/django/entrypoint /entrypoint
      RUN sed -i 's/r//' /entrypoint
      RUN chmod +x /entrypoint

      COPY ./compose/local/django/start /start
      RUN sed -i 's/r//' /start
      RUN chmod +x /start

      COPY ./compose/local/django/celery/worker/start /start-celeryworker
      RUN sed -i 's/r//' /start-celeryworker
      RUN chmod +x /start-celeryworker

      COPY ./compose/local/django/celery/beat/start /start-celerybeat
      RUN sed -i 's/r//' /start-celerybeat
      RUN chmod +x /start-celerybeat

      COPY ./compose/local/django/celery/flower/start /start-flower
      RUN sed -i 's/r//' /start-flower
      RUN chmod +x /start-flower

      WORKDIR /app

      ENTRYPOINT ["/entrypoint"]


      This is my Dockerfile of postgres:



      FROM mdillon/postgis 

      COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
      RUN chmod +x /usr/local/bin/maintenance/*
      RUN mv /usr/local/bin/maintenance/* /usr/local/bin
      && rmdir /usr/local/bin/maintenance


      What am I doing wrong?










      share|improve this question














      I'm trying to use gis in the docker:



      This is Dockerfile of django:



      FROM python:3.6-alpine

      ENV PYTHONUNBUFFERED 1

      RUN apk update
      # psycopg2 dependencies
      && apk add --virtual build-deps gcc python3-dev musl-dev
      && apk add postgresql-dev
      # Pillow dependencies
      && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev
      # CFFI dependencies
      && apk add libffi-dev py-cffi
      # Translations dependencies
      && apk add gettext
      # https://docs.djangoproject.com/en/dev/ref/django-admin/#dbshell
      && apk add postgresql-client


      # ADD PostGIS here
      # POSTGIS dependencies
      ENV POSTGIS_VERSION 2.4.4
      ENV POSTGIS_SHA256 0dff4902556ad45430e2b85dbe7e9baa758c6eb0bfd5ff6948f478beddd56b67


      RUN set -ex

      && apk add --no-cache --virtual .fetch-deps
      ca-certificates
      openssl
      tar

      && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz"
      && echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c -
      && mkdir -p /usr/src/postgis
      && tar
      --extract
      --file postgis.tar.gz
      --directory /usr/src/postgis
      --strip-components 1
      && rm postgis.tar.gz

      && apk add --no-cache --virtual .build-deps
      autoconf
      automake
      g++
      json-c-dev
      libtool
      libxml2-dev
      make
      perl

      # add libcrypto from (edge:main) for gdal-2.3.0
      && apk add --no-cache --virtual .crypto-rundeps
      --repository http://dl-cdn.alpinelinux.org/alpine/edge/main
      libressl2.7-libcrypto
      && apk add --no-cache --virtual .build-deps-testing
      --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing
      gdal-dev
      geos-dev
      proj4-dev
      protobuf-c-dev
      && cd /usr/src/postgis
      && ./autogen.sh
      # configure options taken from:
      # https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
      && ./configure
      # --with-gui
      && make
      && make install
      && apk add --no-cache --virtual .postgis-rundeps
      json-c
      && apk add --no-cache --virtual .postgis-rundeps-testing
      --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing
      geos
      gdal
      py-gdal
      proj4
      protobuf-c
      && cd /
      && rm -rf /usr/src/postgis
      && apk del .fetch-deps .build-deps .build-deps-testing
      # && apk del .fetch-deps .build-deps .build-deps-testing
      # END POSTGIS Changes


      # Requirements are installed here to ensure they will be cached.
      COPY ./requirements /requirements
      RUN pip install -r /requirements/local.txt

      COPY ./compose/production/django/entrypoint /entrypoint
      RUN sed -i 's/r//' /entrypoint
      RUN chmod +x /entrypoint

      COPY ./compose/local/django/start /start
      RUN sed -i 's/r//' /start
      RUN chmod +x /start

      COPY ./compose/local/django/celery/worker/start /start-celeryworker
      RUN sed -i 's/r//' /start-celeryworker
      RUN chmod +x /start-celeryworker

      COPY ./compose/local/django/celery/beat/start /start-celerybeat
      RUN sed -i 's/r//' /start-celerybeat
      RUN chmod +x /start-celerybeat

      COPY ./compose/local/django/celery/flower/start /start-flower
      RUN sed -i 's/r//' /start-flower
      RUN chmod +x /start-flower

      WORKDIR /app

      ENTRYPOINT ["/entrypoint"]


      This is my Dockerfile of postgres:



      FROM mdillon/postgis 

      COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
      RUN chmod +x /usr/local/bin/maintenance/*
      RUN mv /usr/local/bin/maintenance/* /usr/local/bin
      && rmdir /usr/local/bin/maintenance


      What am I doing wrong?







      python django docker gis postgis






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 12 '18 at 12:45









      Narnik GamarnikNarnik Gamarnik

      311213




      311213
























          3 Answers
          3






          active

          oldest

          votes


















          1














          It was only necessary to remove this line of Dockerfile: && apk del .fetch-deps .build-deps .build-deps-testing



          I have not figured it out yet, but most likely it removes all the packages I added above.






          share|improve this answer































            0














            I'm not sure but by reading the debian package section, it does not look like you're installing gdal-dev or libgdal-dev, the name depends on your distribution but you get the idea.






            share|improve this answer





















            • 2





              Most likely, the analogue of libgdal-dev is pkgs.alpinelinux.org/package/edge/testing/x86/gdal-dev

              – Narnik Gamarnik
              Aug 12 '18 at 14:25



















            0














            sudo apt install libgdal20
            that would fix it






            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51808969%2fdjango-core-exceptions-improperlyconfigured-could-not-find-the-gdal-library%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              It was only necessary to remove this line of Dockerfile: && apk del .fetch-deps .build-deps .build-deps-testing



              I have not figured it out yet, but most likely it removes all the packages I added above.






              share|improve this answer




























                1














                It was only necessary to remove this line of Dockerfile: && apk del .fetch-deps .build-deps .build-deps-testing



                I have not figured it out yet, but most likely it removes all the packages I added above.






                share|improve this answer


























                  1












                  1








                  1







                  It was only necessary to remove this line of Dockerfile: && apk del .fetch-deps .build-deps .build-deps-testing



                  I have not figured it out yet, but most likely it removes all the packages I added above.






                  share|improve this answer













                  It was only necessary to remove this line of Dockerfile: && apk del .fetch-deps .build-deps .build-deps-testing



                  I have not figured it out yet, but most likely it removes all the packages I added above.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 11 '18 at 16:10









                  Narnik GamarnikNarnik Gamarnik

                  311213




                  311213

























                      0














                      I'm not sure but by reading the debian package section, it does not look like you're installing gdal-dev or libgdal-dev, the name depends on your distribution but you get the idea.






                      share|improve this answer





















                      • 2





                        Most likely, the analogue of libgdal-dev is pkgs.alpinelinux.org/package/edge/testing/x86/gdal-dev

                        – Narnik Gamarnik
                        Aug 12 '18 at 14:25
















                      0














                      I'm not sure but by reading the debian package section, it does not look like you're installing gdal-dev or libgdal-dev, the name depends on your distribution but you get the idea.






                      share|improve this answer





















                      • 2





                        Most likely, the analogue of libgdal-dev is pkgs.alpinelinux.org/package/edge/testing/x86/gdal-dev

                        – Narnik Gamarnik
                        Aug 12 '18 at 14:25














                      0












                      0








                      0







                      I'm not sure but by reading the debian package section, it does not look like you're installing gdal-dev or libgdal-dev, the name depends on your distribution but you get the idea.






                      share|improve this answer















                      I'm not sure but by reading the debian package section, it does not look like you're installing gdal-dev or libgdal-dev, the name depends on your distribution but you get the idea.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Aug 19 '18 at 15:19

























                      answered Aug 12 '18 at 13:26









                      Steve KSteve K

                      7,83132835




                      7,83132835








                      • 2





                        Most likely, the analogue of libgdal-dev is pkgs.alpinelinux.org/package/edge/testing/x86/gdal-dev

                        – Narnik Gamarnik
                        Aug 12 '18 at 14:25














                      • 2





                        Most likely, the analogue of libgdal-dev is pkgs.alpinelinux.org/package/edge/testing/x86/gdal-dev

                        – Narnik Gamarnik
                        Aug 12 '18 at 14:25








                      2




                      2





                      Most likely, the analogue of libgdal-dev is pkgs.alpinelinux.org/package/edge/testing/x86/gdal-dev

                      – Narnik Gamarnik
                      Aug 12 '18 at 14:25





                      Most likely, the analogue of libgdal-dev is pkgs.alpinelinux.org/package/edge/testing/x86/gdal-dev

                      – Narnik Gamarnik
                      Aug 12 '18 at 14:25











                      0














                      sudo apt install libgdal20
                      that would fix it






                      share|improve this answer




























                        0














                        sudo apt install libgdal20
                        that would fix it






                        share|improve this answer


























                          0












                          0








                          0







                          sudo apt install libgdal20
                          that would fix it






                          share|improve this answer













                          sudo apt install libgdal20
                          that would fix it







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 19 '18 at 13:39









                          PeshPesh

                          1




                          1






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51808969%2fdjango-core-exceptions-improperlyconfigured-could-not-find-the-gdal-library%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How to pass form data using jquery Ajax to insert data in database?

                              National Museum of Racing and Hall of Fame

                              Guess what letter conforming each word