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

initializing rtree.index.Index directly causes QGIS 3.34 and 3.36 to crash and exit. #57320

Closed
1 of 2 tasks
Fanchengyan opened this issue May 2, 2024 · 6 comments
Closed
1 of 2 tasks
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!

Comments

@Fanchengyan
Copy link

What is the bug or the crash?

Initializing rtree.index.Index directly causes QGIS 3.34 and 3.36 to crash and exit.

Steps to reproduce the issue

  1. Open Python Console
  2. run the following script:
from rtree.index import Index, Property
index = Index(interleaved=False, properties=Property(dimension=3))

Then, QGIS will crash and exit directly.

Versions

<style type="text/css"> p, li { white-space: pre-wrap; } </style>
QGIS version 3.34.6-Prizren QGIS code revision 623828f
Qt version 5.15.3
Python version 3.10.12
GDAL/OGR version 3.4.1
PROJ version 8.2.1
EPSG Registry database version v10.041 (2021-12-03)
GEOS version 3.10.2-CAPI-1.16.0
SQLite version 3.37.2
PDAL version 2.3.0
PostgreSQL client version 14.11 (Ubuntu 14.11-0ubuntu0.22.04.1)
SpatiaLite version 5.0.1
QWT version 6.1.4
QScintilla2 version 2.11.6
OS version Ubuntu 22.04.4 LTS
       
Active Python plugins
Geo-SAM 1.0
plugin_reloader 0.9.4
MetaSearch 0.3.6
db_manager 0.1.20
grassprovider 2.12.99
processing 2.12.99
QGIS version 3.34.6-Prizren QGIS code revision [623828f](https://github.com/qgis/QGIS/commit/623828f58c2) Qt version 5.15.3 Python version 3.10.12 GDAL/OGR version 3.4.1 PROJ version 8.2.1 EPSG Registry database version v10.041 (2021-12-03) GEOS version 3.10.2-CAPI-1.16.0 SQLite version 3.37.2 PDAL version 2.3.0 PostgreSQL client version 14.11 (Ubuntu 14.11-0ubuntu0.22.04.1) SpatiaLite version 5.0.1 QWT version 6.1.4 QScintilla2 version 2.11.6 OS version Ubuntu 22.04.4 LTS

Active Python plugins
Geo-SAM
1.0
plugin_reloader
0.9.4
MetaSearch
0.3.6
db_manager
0.1.20
grassprovider
2.12.99
processing
2.12.99

Supported QGIS version

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

New profile

Additional context

No response

@Fanchengyan Fanchengyan added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 2, 2024
@nyalldawson
Copy link
Collaborator

It's safer to use the inbuilt PyQgis spatial index classes (eg QgsSpatialIndex)

@Fanchengyan
Copy link
Author

Hi @nyalldawson ,

Thank you for your prompt response. Do the officials have any plans to fix this issue in future versions of QGIS or rtree? Since the torchgeo library heavily relies on rtree, if this issue persists, the cost of developing deep-learning-related plugins for QGIS will increase dramatically.

@nyalldawson
Copy link
Collaborator

Did you install rtree via pip? Or system package? You've likely got a library mismatch which is clashing with one of the system libraries qgis is using.

@Fanchengyan
Copy link
Author

Hi @nyalldawson ,

TorchGeo depends on rtree>=1, and I'm not sure if the version installed by default in QGIS is lower than this and being forcibly updated. But when we were developing the Geo-SAM plugin last year, the torchgeo at that time should have already had this dependency requirement, but the QGIS 3.30 at that time did not have this problem. This issue was only recently reported to us by our users (coolzhao/Geo-SAM#43), and it seems to have occurred around QGIS 3.34/3.36. I have tried to reinstall all versions of rtree between [1.0, 1.2], but QGIS still crashes. Is there any way to resolve this issue?

@nyalldawson
Copy link
Collaborator

Is there any way to resolve this issue?

Not from the qgis side, no.

By installing rtree via pip you're installing and using a different version of libspatialindex vs the system installed version of the library coming from the Ubuntu repository (which qgis uses). This library conflict results in the crash.

The solution would be to ensure you never install rtree via pip, and instead install it only from the Ubuntu repositories (python3-rtree).

Given that this isn't a qgis bug, I'm closing the ticket. But feel free to reply if you have further questions

@Fanchengyan
Copy link
Author

Thanks, this solves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
Development

No branches or pull requests

2 participants