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

rtree causes crash during Dataset init #13

Open
MaximeRM opened this issue Sep 10, 2024 · 6 comments
Open

rtree causes crash during Dataset init #13

MaximeRM opened this issue Sep 10, 2024 · 6 comments

Comments

@MaximeRM
Copy link
Collaborator

MaximeRM commented Sep 10, 2024

Qgis crashes when testing the encoder. Error on the terminal below:

With python 3.12; Ubuntu 24.04.

Potentially related to this: qgis/QGIS#56599

QGIS died on signal 11
This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.ubuntu.com>
Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.

warning: could not find '.gnu_debugaltlink' file for /usr/bin/qgis.bin
Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No thread selected
No stack.
gdb returned 256
Aborted (core dumped)
@ptresson
Copy link
Collaborator

I've reproduced the crash with a fresh conda environment with python 3.12. with defaut parameters during encoding. I'll see what can be used to work around this. The QGIS issue seems to suggest we are not the only ones having problems with python 3.12, it may be outside the scope of the plugin.

@ptresson ptresson changed the title Qgis crash python version? Python 3.12 causes QGIS to crash during encoding Sep 10, 2024
@ptresson
Copy link
Collaborator

ptresson commented Sep 10, 2024

crash happens during the creation of a torchgeo RasterDatatsetmore precisely.
More precisely, the crash happens during the init of an Handle IndexHandle, inside a Rtree in a GeoDataset.
So the issue is GIS related and not due to deep learning dependencies or RAM or such.

@ptresson
Copy link
Collaborator

working env:

Python 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:36:13) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rasterio
>>> rasterio.show_versions()
rasterio info:
  rasterio: 1.3.9
      GDAL: 3.8.3
      PROJ: 9.3.1
      GEOS: 3.12.1
 PROJ DATA: /home/tresson/mambaforge/envs/geosam/share/proj
 GDAL DATA: /home/tresson/mambaforge/envs/geosam/share/gdal

System:
    python: 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:36:13) [GCC 12.3.0]
executable: /home/tresson/mambaforge/envs/geosam/bin/python
   machine: Linux-6.8.0-40-generic-x86_64-with-glibc2.35

Python deps:
    affine: 2.4.0
     attrs: 23.2.0
   certifi: 2024.02.02
     click: 8.1.7
     cligj: 0.7.2
    cython: None
     numpy: 1.26.4
    snuggs: 1.4.7
click-plugins: None
setuptools: 69.1.0
>>>

broken env:

import rasterio
rasterio.show_versions()
rasterio info:
  rasterio: 1.3.11
      GDAL: 3.9.2
      PROJ: 9.4.1
      GEOS: 3.12.2
 PROJ DATA: /home/tresson/mambaforge/envs/test/share/proj
 GDAL DATA: /home/tresson/mambaforge/envs/test/share/gdal

System:
    python: 3.12.5 | packaged by conda-forge | (main, Aug  8 2024, 18:57:17) [GCC 12.4.0]
executable: /home/tresson/mambaforge/envs/test/bin/python3
   machine: Linux-6.8.0-40-generic-x86_64-with-glibc2.35

Python deps:
    affine: 2.4.0
     attrs: 24.2.0
   certifi: 2024.08.30
     click: 8.1.7
     cligj: 0.7.2
    cython: None
     numpy: 2.1.1
    snuggs: 1.4.7
click-plugins: None
setuptools: 73.0.1

@ptresson
Copy link
Collaborator

ptresson commented Oct 1, 2024

related:
qgis/QGIS#57320

creating an rtree index in the QGIS python console is sufficient to cause the crash

@ptresson
Copy link
Collaborator

ptresson commented Oct 1, 2024

a working solution seem to uninstall pip rtree and install it via package manager

https://geo-sam.readthedocs.io/en/latest/blog/2024/05-02_crash_on_QGIS.html
coolzhao/Geo-SAM#43

@ptresson ptresson changed the title Python 3.12 causes QGIS to crash during encoding rtree causes crash during Dataset init Oct 1, 2024
@ptresson
Copy link
Collaborator

ptresson commented Oct 1, 2024

several solutions have been found:

  • limit to QGIS < 3.36 (which does seem a bad idea)
  • link to other ressources on how to solve the issue
  • For our usage, uninstalling rtree > 1.0 after torchgeo install (since its a dependencie), then installing rtree < 1.0 via pip seem to work. this will need post installation checkups but could work. Such post installation scripts could be of use for other conflicts such as proj and rasterio versions or others (see Package installation issue with pyproj #17)

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

No branches or pull requests

2 participants