Skip to content
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

Using xarray in Docker on a mac fails with "No such file or directory: 'gdal-config'" #7705

Closed
28raining opened this issue Mar 31, 2023 · 6 comments

Comments

@28raining
Copy link

What is your issue?

Hi,

This is my docker file "Dockerfile":

FROM python:3.11.2-slim
RUN /usr/local/bin/python -m pip install --upgrade pip
RUN pip install xarray[io]

Which is built with this command:
docker build -t "name:Dockerfile" .

My docker version is:
Docker version 20.10.23, build 7155243

And I'm running macOS Ventura 13.3

Error message:

#6 11.79   Downloading rasterio-1.3.6.tar.gz (408 kB)
#6 11.83      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 408.5/408.5 kB 12.4 MB/s eta 0:00:00
#6 11.86   Installing build dependencies: started
#6 14.05   Installing build dependencies: finished with status 'done'
#6 14.05   Getting requirements to build wheel: started
#6 14.17   Getting requirements to build wheel: finished with status 'error'
#6 14.17   error: subprocess-exited-with-error
#6 14.17   
#6 14.17   × Getting requirements to build wheel did not run successfully.
#6 14.17   │ exit code: 1
#6 14.17   ╰─> [2 lines of output]
#6 14.17       WARNING:root:Failed to get options via gdal-config: [Errno 2] No such file or directory: 'gdal-config'
#6 14.17       ERROR: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
#6 14.17       [end of output]
@28raining 28raining added the needs triage Issue that has not been reviewed by xarray team member label Mar 31, 2023
@28raining
Copy link
Author

Note that it works outside of docker on my mac, and it also works inside of Docker on Centos

@jhamman
Copy link
Member

jhamman commented Mar 31, 2023

This doesn't seem like an issue with Xarray. If you change your dockerfile to:

FROM python:3.11.2-slim
RUN /usr/local/bin/python -m pip install --upgrade pip
RUN pip install xarray
RUN pip install rasterio

I suspect you will find that you get the same error on the rasterio line and not on the xarray line.

A second note: Xarray and netcdf4 have not released complete support for python 3.11. For that reason, you may also want to use the python 3.10 image.

@jhamman jhamman added usage question and removed needs triage Issue that has not been reviewed by xarray team member labels Mar 31, 2023
@28raining
Copy link
Author

Thanks. Note same error on Python 3.9.6.

I have filed a ticket on Rasterio then
rasterio/rasterio#2801

@abunimeh
Copy link

run RUN apt-get update && apt-get install --yes libgdal-dev before pip

@jhamman
Copy link
Member

jhamman commented Apr 3, 2023

Thanks for following up @28raining. Based on your response, I'm going to close this as it doesn't seem that Xarray is the issue.

@jhamman jhamman closed this as completed Apr 3, 2023
@psychemedia
Copy link

As well as libgdal-dev I noticed that g++ was also required for the Fiona wheel build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants