pyproj4 / pyproj

Python interface to PROJ (cartographic projections and coordinate transformations library)
https://pyproj4.github.io/pyproj
MIT License
1.04k stars 210 forks source link

Bad_alloc with pyroj import in QGIS plugin #1414

Open phorgue opened 1 month ago

phorgue commented 1 month ago

Problem description

The following error may occur when trying to import pyproj into a QGIS plugin

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Abandon (core dumped)

I was able to identify that this error only occurs when the pyproj package has been installed using pip

The error does not occur if the package has been installed using a package manager, for example for ubuntu

sudo apt install python3-pyproj

This error was observed on several versions of linux (ubuntu/fedora) and on different versions of QGIS (3.28/ 3.34). There doesn't seem to be any link with the pyproj version (installing an identical or more recent version using pip systematically causes the error)

To reproduce

Simply add :

import pyproj

to a plugin QGIS source files and install pyproj using pip. QGIS should stop while loading the plugin with the bad_alloc error.