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

Error when installing python bindings extension #11636

Open
SeeRich opened this issue Jan 10, 2025 · 1 comment · May be fixed by #11637
Open

Error when installing python bindings extension #11636

SeeRich opened this issue Jan 10, 2025 · 1 comment · May be fixed by #11637
Assignees

Comments

@SeeRich
Copy link

SeeRich commented Jan 10, 2025

What is the bug?

I get the following error when attempting to build the python bindings:

error: option --install-layout not recognized

More context:

#13 163.8 [1/4] cd /build/gdal/ogr/ogrsf_frmts/ods && /usr/local/lib/python3.13/dist-packages/cmake/data/bin/cmake -DIN_FILE=ods_formula_parser.y -DTARGET=generate_ods_formula_parser -DEXPECTED_MD5SUM=4471312c8be1baeef3509fb36ab668df -DFILENAME_CMAKE=/build/gdal/ogr/ogrsf_frmts/ods/CMakeLists.txt -P /build/gdal/cmake/helpers/check_md5sum.cmake
#13 163.8 [2/4] cd /build/gdal/ogr && /usr/local/lib/python3.13/dist-packages/cmake/data/bin/cmake -DIN_FILE=swq_parser.y -DTARGET=generate_swq_parser "-DEXPECTED_MD5SUM=47b674ecca1fc71a50bc81d7d0bfa29d   " -DFILENAME_CMAKE=/build/gdal/ogr/CMakeLists.txt -P /build/gdal/cmake/helpers/check_md5sum.cmake
#13 163.8 [3/4] cd /build/gdal/build && /usr/local/lib/python3.13/dist-packages/cmake/data/bin/cmake -DSOURCE_DIR=/build/gdal/cmake/helpers/../.. -DBINARY_DIR=/build/gdal/build -DGDAL_SHA1SUM= -DGDAL_RELEASE_DATE= -P /build/gdal/cmake/helpers/../../cmake/helpers/generate_gdal_version_h.cmake
#13 163.8 [3/4] Install the project...
#13 163.8 -- Install configuration: "Release"
#13 163.8 CMake Deprecation Warning at swig/python/install_python.cmake:1 (cmake_policy):
#13 163.8   Compatibility with CMake < 3.10 will be removed from a future version of
#13 163.8   CMake.
#13 163.8
#13 163.8   Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
#13 163.8   to tell CMake that the project requires at least <min> but has been updated
#13 163.8   to work with policies introduced by <max> or earlier.
#13 163.8 Call Stack (most recent call first):
#13 163.8   swig/python/cmake_install.cmake:46 (include)
#13 163.8   swig/cmake_install.cmake:47 (include)
#13 163.8   cmake_install.cmake:111 (include)
#13 163.8
#13 163.8
#13 164.0 Using numpy 2.2.1
#13 164.0 /usr/local/lib/python3.13/dist-packages/setuptools/config/_apply_pyprojecttoml.py:81: SetuptoolsWarning: `extras_require` overwritten in `pyproject.toml` (optional-dependencies)
#13 164.0   corresp(dist, value, root_dir)
#13 164.0 usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
#13 164.0    or: setup.py --help [cmd1 cmd2 ...]
#13 164.0    or: setup.py --help-commands
#13 164.0    or: setup.py cmd --help
#13 164.0
#13 164.0 error: option --install-layout not recognized
#13 164.1 CMake Error at swig/python/install_python.cmake:33 (message):
#13 164.1   Installation of python bindings failed
#13 164.1 Call Stack (most recent call first):
#13 164.1   swig/python/cmake_install.cmake:46 (include)
#13 164.1   swig/cmake_install.cmake:47 (include)
#13 164.1   cmake_install.cmake:111 (include)

Steps to reproduce the issue

This is built inside of docker:

docker build --progress plain -t gdal-testing .

Dockerfile:

FROM ubuntu:24.04

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    DEBIAN_FRONTEND=noninteractive

# Apt update
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
    software-properties-common \
    build-essential \
    wget \
    sqlite3 \
    libsqlite3-dev \
    libproj-dev \
    libtiff-dev \
    libjpeg-dev \
    libpng-dev \
    libgif-dev \
    libcurl4-openssl-dev \
    libgeos-dev \
    libexpat1-dev \
    zlib1g-dev \
    swig \
    && rm -rf /var/lib/apt/lists/*

# Add the deadsnakes PPA
RUN add-apt-repository ppa:deadsnakes/ppa

# Install system dependencies
ARG PYTHON_VERSION=3.13
RUN apt-get update && apt-get install -y \
    python${PYTHON_VERSION} \
    python${PYTHON_VERSION}-dev \
    python${PYTHON_VERSION}-venv \
    python3-pip \
    && rm -rf /var/lib/apt/lists/*

# Install python packages and build tools
RUN python3.13 -m pip install -U setuptools cmake ninja numpy

WORKDIR /build

# Build and install GDAL from source
ENV GDAL_VERSION=3.10.0
ADD https://github.com/OSGeo/gdal.git#v${GDAL_VERSION} gdal
RUN cd gdal && \
    cmake -S . -B build -G Ninja \
    -DBUILD_PYTHON_BINDINGS=ON \
    -DCMAKE_BUILD_TYPE=Release && \
    cmake --build build && \
    cmake --build build --target install 2>&1 | tee /build/gdal-build.log
RUN ldconfig && rm -rf gdal

# Set working directory
WORKDIR /app

# Command to run the application
CMD ["/bin/bash"]

Versions and provenance

Ubuntu 24.04
Python 3.13

Additional context

No response

@SeeRich
Copy link
Author

SeeRich commented Jan 10, 2025

Looks like this is fine for python 3.11, maybe I'm using too new of a version...

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

Successfully merging a pull request may close this issue.

2 participants