2

I am trying to get the toolbox to work in QGIS 2.6, but I keep getting an error message that SAGA is not properly configured. After much digging, I finally found I can set the SAGA folder in Processing > Options > Providers > SAGA. I installed SAGA with macports. The saga_cmd executable is in my /opt/local/bin folder, but setting this as my folder does not fix the problem. I continue to get the error message.

Does anyone know how I can configure QGIS to find my saga installation?

3

If you read QGIS: 17.8. Running an external algorithm:

Instead, you must install SAGA and make sure that the SAGA folder is in PATH, so it can be called from the console (just open a console and type saga_cmd to check it)

It is for Linux, but it is the same for Mac OS X: can you use saga_cmd in the terminal ? .

If not, you need to fix your PATH variable or you can try to modify the script SagaUtils.py (.../python/plugins/processing/algs/saga/SagaUtils.py) used by the processing module to find the Saga folder installation and execute the algorithms on this basis:

def findSagaFolder():
    folder = None
    if isMac():
        testfolder = os.path.join(QgsApplication.prefixPath(), 'bin')
        if os.path.exists(os.path.join(testfolder, 'saga_cmd')):
           folder = testfolder
    else:
        testfolder = '/usr/local/bin'
        if os.path.exists(os.path.join(testfolder, 'saga_cmd')):
            folder = testfolder

isMac() is for the KingChaos version where saga_cmd and the libraries are in the Application bundle.

All the other functions of SagaUtils.py use this resulting Saga path.

In my case, for example, I installed saga_cmd in /Users/me/saga/bin/saga_cmd which is in my PATH and I can use Saga in the masters versions of Larry Shaffer (no Saga installed in the application bundle)

  • Yes, I can see saga_cmd in the console and I have /opt/local/bin added to my path and in SAGA folder. I am going to try your trick with SagaUtils.py right now. Thanks! – user14241 Feb 25 '15 at 22:40
  • I don't have a SagaUtils.py on my system. So now I'm going to try the King Chaos binary and see if that does it for me. – user14241 Feb 25 '15 at 22:47
  • Thanks for the tip! The King Chaos build works for me. Its a shame the macports version can't build with out of the box SAGA support. – user14241 Feb 25 '15 at 23:02
1

The approach of gene works also for SAGA installations via homebrew.

Here are the specific changes made in findSagaFolder() to upgrade SAGA to version 2.2.2 in QGIS 2.14. Note that hombrew installations are always placed in /usr/local/Cellar/.

# testfolder = os.path.join(QgsApplication.prefixPath(), 'bin')
testfolder = '/usr/local/Cellar/saga-gis/2.2.2/bin'

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.