semiautomaticgit/SemiAutomaticClassificationPlugin

SACP blocks Georeferencer in MacOS version of QGIS

Closed this issue · 11 comments

If SACP is installed, the QGIS included GDAL Georeferencer (available from Raster->Georeferencer), will not work and will crash QGIS (will hang when the progress bar appears). The only way to make it work again is to uninstall SACP completely.
Cheers

Hello, thank you for reporting this. I'll look into it.

Thank you Luca. I'll be available for testing it if needed. Best Regards

This is also the case on Windows 10 installations, SCP must be disabled to use the Georeferencer. This appears to be something that occurs when QGIS starts and the plugin is initialized as there is a "threadsValue" line that is placed in the QGIS.ini file at start-up. A github member called 'RinceWND' described this behavior in the QGIS page.

qgis/QGIS#46327

@mbodnar-GS Thank you for referencing the issue here!

I believe the culprit is the GDAL_NUM_THREADS option that is set here:

cfg.gdalSCP.SetConfigOption('GDAL_NUM_THREADS', str(cfg.threads))

Seems like these settings are global for QGIS, and GDAL's ChunkAndWarpImage function doesn't like this specific one.

Hello and thank you @mbodnar-GS and @RinceWND .
It is a really strange issue. I'll try to fix this from the SCP side.
As a workaround for using the Georeferencer, I recommend disabling SCP temporary.

I'm already doing the temporary disable trick. Hope this is a simple one to fix.

The funny thing is that I can't seem to reproduce the issue on an Ubuntu machine with QGIS 3.22, which I believe is installed from ppa... The georeferencer works flawlessly regardless of the plugin's threads number value.
On my Windows machine I just left CPU threads value to 1 as a workaround which works for me.

Edit: I've managed to reproduce the issue with a Pop!_OS (practically Ubuntu?) machine and QGIS 3.16 installed as a flatpak. The symptoms are all the same -- georeferencer doesn't work if threadsValue is not 1. So, maybe this is an issue with GDAL that is being put into the Win/Mac/Linux packages? The Ubuntu machine mentioned above has GDAL 3.0.2 (while python console in QGIS shows 3.0.4), however the flatpak in Pop!_OS uses 3.4.0 from what I can tell (python console confirms that), while the system itself has the version 3.2.2 installed. I'm not sure if the Ubuntu's QGIS from PPA uses the system installation of GDAL or not, but it feels to me as a most likely explanation that something went wrong in GDAL itself, and this "faulty" version is now packed into the QGIS distributions.
I'm not qualified for this investigation, though -- my understanding of how it all works is insufficient for learning what causes the issue at hand.

PS. Sorry for posting it here. Just needed somewhere to store my "findings" since I'll soon forget about it switching to my usual work.

Possibly triggering this bug qgis/QGIS#41770

An option would be to increase the number of threads for operations that would benefit from it and the setting the number back to one. Or make the feedback handle the multithread in the georeferencer.

I experienced this issue on Windows 10 using QGIS 3.22.0, disabling the SCP plugin and restarting QGIS fixed the issue. Posting so others like me who came from Google will know of the temporary fix.

This is the root cause of the issue reported at: qgis/QGIS#46327.
Possibly triggering also this issue: qgis/QGIS#50107.
@semiautomaticgit, are you looking at way to fix this issue?

Thank you for your feedback.
I have changed the behavior of the SCP in version 7.10.7 to avoid the triggering of this issue.

To be clear, the Georeferencer plugin issue is not caused by the SCP.
The SCP sets the GDAL configuration option GDAL_NUM_THREADS.
The Georeferencer plugin has issues if this option GDAL_NUM_THREADS is greater than 1.
Georeferencer plugin developers may have to fix this issue, because other plugins or users could change this option and trigger the issue in the future.