Skip to content

vcpkg build on windows : ModuleNotFoundError: No module named 'osgeo' #63975

@jbp35

Description

@jbp35

What is the bug or the crash?

I am trying to build qgis with vcpkg on windows but I get the following error:

Installing 3/4 gdal[arrow,arrow-adbc,core,curl,expat,freexl,geos,gif,hdf5,iconv,jpeg,kea,lerc,libkml,libspatialite,libxml2,lzma,netcdf,openjpeg,openssl,parquet,pcre2,png,poppler,postgresql,python,qhull,recommended-features,sqlite3,tools,webp,zstd]:[email protected]...
Building gdal[arrow,arrow-adbc,core,curl,expat,freexl,geos,gif,hdf5,iconv,jpeg,kea,lerc,libkml,libspatialite,libxml2,lzma,netcdf,openjpeg,openssl,parquet,pcre2,png,poppler,postgresql,python,qhull,recommended-features,sqlite3,tools,webp,zstd]:[email protected]...
C:\dev\QGIS-wsl\vcpkg\triplets\x64-windows-release.cmake: info: loaded overlay triplet from here
C:\Users\....\AppData\Local\vcpkg\registries\git-trees\6b75ecd3df41aafb76ed73709be1b99f80df6035: info: installing from git registry git+https://github.com/open-vcpkg/python-registry@6b75ecd3df41aafb76ed73709be1b99f80df6035
-- Using cached OSGeo-gdal-v3.11.4.tar.gz
-- Cleaning sources at C:/s/gdal/src/v3.11.4-2573e8bdc4.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Users/Jean-BaptistePETER/AppData/Local/vcpkg/downloads/OSGeo-gdal-v3.11.4.tar.gz
-- Applying patch adopt-compile-only.diff
-- Applying patch find-link-libraries.patch
-- Applying patch fix-gdal-target-interfaces.patch
-- Applying patch generate-config.diff
-- Applying patch libkml.patch
-- Applying patch sqlite3.diff
-- Applying patch target-is-valid.patch
-- Using source at C:/s/gdal/src/v3.11.4-2573e8bdc4.clean
-- Found external ninja('1.12.1').
-- Configuring x64-windows-release
-- Building x64-windows-release-rel
-- Fixing pkgconfig file: C:/dev/QGIS-wsl/build/vcpkg_installed/vcpkg/pkgs/gdal_x64-windows-release/lib/pkgconfig/gdal.pc
-- Using cached msys2-mingw-w64-x86_64-pkgconf-1~2.3.0-1-any.pkg.tar.zst
-- Using cached msys2-msys2-runtime-3.5.4-2-x86_64.pkg.tar.zst
-- Using msys root at C:/Users/.../AppData/Local/vcpkg/downloads/tools/msys2/21caed2f81ec917b
-- Testing package!
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
    Command failed: C:/dev/QGIS-wsl/build/vcpkg_installed/x64-windows-release/tools/python3/python.exe C:/s/gdal/import_test.py
    Working Directory: C:/s/gdal
    Error code: 1
    See logs for more information:
      C:\s\gdal\python-test-import-x64-windows-release-err.log

Call Stack (most recent call first):
  C:/dev/QGIS-wsl/build/vcpkg_installed/x64-windows-release/share/vcpkg-python-scripts/vcpkg_python_functions.cmake:192 (vcpkg_execute_required_process)
  C:/Users/.../AppData/Local/vcpkg/registries/git-trees/6b75ecd3df41aafb76ed73709be1b99f80df6035/portfile.cmake:189 (vcpkg_python_test_import)
  scripts/ports.cmake:203 (include)


error: building gdal:x64-windows-release failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle gdal:x64-windows-release: 8.2 min
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+gdal
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[gdal]+Build+error+on+x64-windows-release&body=Copy%20issue%20body%20from%20C%3A%2Fdev%2FQGIS-wsl%2Fbuild%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md

-- Running vcpkg install - failed
CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/VC/vcpkg/scripts/buildsystems/vcpkg.cmake:938 (message):
  vcpkg install failed.  See logs for more information:
  C:\dev\QGIS-wsl\build\vcpkg-manifest-install.log
Call Stack (most recent call first):
  build/CMakeFiles/3.31.6/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:72 (project)


-- Configuring incomplete, errors occurred!

Here is the content of C:\s\gdal\python-test-import-x64-windows-release-err.log:

Added vcpkg bin path to search for dlls. Path added: C:\dev\QGIS-wsl\build\vcpkg_installed\x64-windows-release\bin 
Traceback (most recent call last):
  File "C:\s\gdal\import_test.py", line 14, in <module>
    from osgeo.gdal import *
ModuleNotFoundError: No module named 'osgeo'

Steps to reproduce the issue

cmake -S . ^
      -B build ^
      -G Ninja ^
      -D CMAKE_BUILD_TYPE=Release ^
      -D WITH_VCPKG=ON ^
      -D CREATE_ZIP=ON ^
      -D VCPKG_TARGET_TRIPLET=x64-windows-release ^
      -D VCPKG_HOST_TRIPLET=x64-windows-release ^
       -D WITH_DESKTOP=ON ^
       -D WITH_3D=OFF ^
       -D WITH_BINDINGS=ON ^
       -D ENABLE_TESTS=OFF ^
      -D BUILD_WITH_QT6=ON ^
       -D USE_CCACHE=ON ^
       -D ENABLE_UNITY_BUILDS=ON ^
       -D FLEX_EXECUTABLE="C:/dev/qgis-utils/win_flex_bison/win_flex.exe" ^
       -D BISON_EXECUTABLE="C:/dev/qgis-utils/win_flex_bison/win_bison.exe" ^
      -D WITH_QTWEBKIT=OFF ^
      -D WITH_QTWEBENGINE=ON ^
      -D VCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:/s" ^
      -D CMAKE_INSTALL_PREFIX="C:/Qgis_local"

Versions

3.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugEither a bug report, or a bug fix. Let's hope for the latter!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions