3

I am writing a QGIS plugin using SAGA by Processing. Is is possible to test whether SAGA is installed and which version is on?

For GDAL, it's OK with:

processing.tools.raster.gdal.__version__
5

You might to want to look at some of the python code for SAGA algorithm providers, especially the module SagaUtils.py - that has a getSagaInstalledVersion() function, and a few functions for building the paths etc.

This is an example from the Python Console:-

>>> processing.algs.saga.SagaUtils.getSagaInstalledVersion()
'2.2.0'

Looking at the code, it's a wrapper around an external call to saga_cmd -v with retry logic

  • This is concise and works right ! – Jean Hemmi Dec 6 '15 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.