-
Notifications
You must be signed in to change notification settings - Fork 1.2k
GDAL installation added to python env. #11397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
python/Dockerfile
Outdated
|
||
# Download and build GDAL from source using CMake | ||
WORKDIR /tmp | ||
RUN wget --no-check-certificate http://download.osgeo.org/gdal/3.10.1/gdal-3.10.1.tar.gz && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeffwidman or @jakecoffman or @pavera , is there another way to get gdal that doesn't require going to grab it via wget
? Just in case you all know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated wget to git clone, Still I would like to know your thought on this implementation pls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you compiling GDAL instead of installing the existing .deb packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem that I am trying to resolve here is a compatibility issue
Exception: Python bindings of GDAL 3.9.3 require at least libgdal 3.9.3, but 3.0.4 was found
Steps to reproduce:
- Go to https://github.com/techmatters/soil-id-algorithm
- Create new codespace for this repo
- In terminal run
make install
- Error :
gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
- In order to fix this you need to install
libgdal-dev
sudo apt-get update
sudo apt-get install libgdal-dev
- Once that's done, run
make install
again - Error:
Exception: Python bindings of GDAL 3.9.3 require at least libgdal 3.9.3, but 3.0.4 was found
So I need to ensure that all the packages that I am installing is compatible with each other. That is why I chose 3.10.1 latest gdal version and installing all the compatible packages to that version here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paulschreiber Please feel free to share your thoughts on any better way to resolve this, I am happy take that to my team's discussion. and make that available on dependabot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We ended up adjusting the debian sources list to testing
to get current GDAL, since bookworm is behind:
https://github.com/techmatters/terraso-backend/blob/main/Dockerfile#L11-L13
RUN sed 's/bookworm/testing/g' /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/testing.sources
RUN echo 'Package: libgdal-dev gdal-bin\nPin: release a=testing\nPin-Priority: 900' > /etc/apt/preferences.d/gdal-testing
RUN git clone https://github.com/OSGeo/gdal.git /usr/local/src/gdal \ | ||
&& cd /usr/local/src/gdal \ | ||
&& git checkout v3.10.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building gdal from source seems excessive here. This adds complexity to our builds and requires us to manually maintain the gdal version. Could we find a simpler solution that doesn't involve building gis libraries from source?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other approaches to install gdal has failed with Exception: Python bindings of GDAL 3.10.1 require at least libgdal 3.10.1, but 3.4.1 was found
exception
Command that gave above exception: pyenv exec pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org gdal
even apt-get also failed with the same exception (version conflicts, 3.4.1 comes with python installation by default and 3.10.1 is the latest)
And this gdal installation from the source ensures the presence of all the necessary gdal native libraries, which is needed to build a gdal based application.
And I have used version checkout that will ensure that we are using stable release. or the tested and released version is being used.
Note: There are other sources for installation such as Anaconda and Mamba but those are commercial products needs approval from the team to go ahead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern isn't just about the implementation method, but rather about the fundamental decision to add gdal to our container at all. This raises several questions:
- Why do we need gdal in the container?
- If we add gdal for one Python version, shouldn't we maintain consistency across all our ecosystems?
- Are we setting a precedent for adding large, specialized libraries to our base container?
While I understand the issue you are trying to fix, I'm worried about the implications of this approach for our architecture.
As we have decided consider this as a feature request, I am closing this PR. |
What are you trying to accomplish?
Providing fixes for gdal related issues in this workflow
Solution provide
Anything you want to highlight for special attention from reviewers?
SSL verification disabled for get_dependency_hash function, As we are working in a trusted environment : https://pypi.org/simple
How will you know you've accomplished your goal?
Ran the cli in local and ensured below output
Checklist