# SAGA algorithms not working on Qgis 2.18 on Mac OSX

Since last update to Qgis 2.18 from 2.14, I'm unable to successfully run SAGA algorithms (Mac OSX Yosemite). No matters if it is vector- or raster-oriented algorithm, the algorithm stops at this point with a message similar to :

"..Converting outputs
The following layers were not correctly generated.
Kernel


I can run SAGA algorithms for tables, tough. (e.g. Running Average works well). This makes me think that SAGA is correctly installed.

What I've tried so far:

• I've reinstalled Qgis from scratch.
• I've the same problem in two different Macs
• I've checked the options in Processing (there is no option for SAGA folder as before)
• I've checked the advanced preferences in QGIS (also, there is no option for SAGA folder)
• I've deleted the /Users/user/.qgis2 folder before installing 2.18

EDIT: SAGA version is 2.2.3. It is installed automatically with Qgis.

EDIT 2: Exactly same symptoms in a second Mac. Reinstalled Qgis 2.14 and SAGA is live again (Saga version in Qgis 2.14 seems to be 2.1.4).

EDIT 3: New attempt in a brand new Mac resulted in the same symptoms.

¿Any ideas?

I'm pasting the full log of a failed execution, if it helps.

Algorithm Add coordinates to points starting...
shapes_points "Add Coordinates to points" -INPUT "/var/folders/r2/b15t0jvd45x_s7r0h1cpc0zh0000gn/T/processing644d036e8bde4096a10cdf7e37ed56a5/1478841643.755.shp" -OUTPUT "/var/folders/r2/b15t0jvd45x_s7r0h1cpc0zh0000gn/T/processing644d036e8bde4096a10cdf7e37ed56a5/78dc7b6f275e49afb2ec5dc408bcc39e/OUTPUT.shp"
/Users/daniel/.qgis2//processing/saga_batch_job.sh: line 3: 5770 Segmentation fault: 11 saga_cmd shapes_points "Add Coordinates to points" -INPUT "/var/folders/r2/b15t0jvd45x_s7r0h1cpc0zh0000gn/T/processing644d036e8bde4096a10cdf7e37ed56a5/1478841643.755.shp" -OUTPUT "/var/folders/r2/b15t0jvd45x_s7r0h1cpc0zh0000gn/T/processing644d036e8bde4096a10cdf7e37ed56a5/78dc7b6f275e49afb2ec5dc408bcc39e/OUTPUT.shp"
Converting outputs

The following layers were not correctly generated.
Points with coordinates

• what version of saga? (run saga_cmd -v from the console... does that segfault too?) – Steven Kay Nov 11 '16 at 8:15
• Make sure you don't a processing folder in the python folder. – Alexandre Neto Nov 12 '16 at 14:52
• Alexandre is suggesting that there might be an old broken version of Processing in /User/daniel/.qgis/python/plugins. – underdark Nov 21 '16 at 20:05
• I'm having the same issue. Here is the contents of the saga_batch_job.sh: export SAGA_MLB=/Applications/QGIS.app/Contents/MacOS/bin/../lib/saga export PATH=/Applications/QGIS.app/Contents/MacOS/bin:$PATH saga_cmd shapes_tools "Shapes Buffer" -SHAPES "/Users/maples/Downloads/USB/Excercises/Geoprocessing with QGIS/EX_02_Snow_Map/Data/Death_Addresses.shp" -DIST_FIELD_DEFAULT 4 -NZONES 5 -DARC 5 -DISSOLVE false -POLY_INNER false -BUFFER "/var/folders/2f/rt0btmz538d4trvm0klkjjrw0000gr/T/processing1d45f484019b4cc6abb6b751b28bb97d/3b94b58f1b264f798a87630940ea3d86/BUFFER.shp" exit – Stacey Maples Nov 22 '16 at 18:02 • Definitely a systemic prblem with SAGA in the new version 2.18 Las Palmas. All tools failing with the same errors as described above. – Stacey Maples Nov 22 '16 at 18:15 ## 2 Answers I think the problem is that the QGIS processing tools for SAGA are sending an incorrectly-named parameter to saga_cmd, both via the description files for the saga commands, and also in the the script SagaAlgorithm214.py. The correct parameter should be "RESAMPLING" but the QGIS processing files use "INTERPOL". (These files are found on my machine at /usr/share/qgis/python/plugins/processing/algs/saga/ and /usr/share/qgis/python/plugins/processing/algs/saga/description/2.2.3). So far I have only tried changing "INTERPOL" to "RESAMPLING" in the Python script, and in the description file for mosaicking, but after the change the mosaicking tool works fine. (I'll do a batch change on all the description files and report my results when I get a chance.) My guess is that this is all caused by some versioning mismatch: I'm using QGIS 2.18.3 (Linux Mint 17.3), where the most recent directory for SAGA descriptions is for version 2.2.3, while my SAGA version is 2.2.7. UPDATE: I ran the following bash commands in a terminal on my machine, and this (along with the edit to SagaAlgorithm214.py) seemed to fix the problem on the SAGA tools I spot-checked: su -i cd /usr/share/qgis/python/plugins/processing/algs/saga/description mv 2.2.3 2.2.3_old mkdir 2.2.3 cd 2.2.3_old for i in *.txt; do sed "s/|INTERPOL|/|RESAMPLING|/g"$i > ../2.2.3/\$i ; done

• Thanks for your input Don. But this problem is systematic with all SAGA algorithms, not only rasters. Would you check if vector algorithms are working? – Temporalista Feb 9 '17 at 15:50
• I tried creating a vector buffer, and also clipping a raster with a vector. Both worked. – Don Feb 9 '17 at 16:58
• @Temporalista, have you had any further luck with SAGA? – Don Feb 16 '17 at 21:29
• @Don I guess your workaround does not apply here because the naming problem was introduced for SAGA > 2.2.4 (hub.qgis.org/issues/14735). QGIS for Mac comes with SAGA 2.2.2. Applying your fix ends up with "Unknown long option 'RESAMPLING'" because RESAMPLING is not known by SAGA prior to v2.2.4 – pat-s Mar 8 '17 at 23:53
• @pat-s That link exactly describes the problem I had, but it looks like my solution is for a different problem than the one posted. By the way, what shows up in the log messages panel when you use the (unaltered) SAGA tools? That's where I first noticed the "INTERPOL/RESAMPLING" mismatch, there may be something similar going on that shows up there. – Don Mar 9 '17 at 1:08

This solved the missing SAGA algorithm issue for me: (Running OSX 10.9.5 on a Macbook Pro (~2013 ish, I think)

1. Install QGIS 2.14 - the SAGA algorithms were present and worked for me on this version.
2. In Finder, navigate to /Users/user/Applications/QGIS.app/Contents/Resources/python/plugins/processing/algs
3. In "algs", copy the folder "saga" and stick it on your desktop (or somewhere similarly handy).
4. Delete QGIS.app and /Users/user/.qgis2
5. Install QGIS 2.18
6. In Finder, navigate to /Users/user/Applications/QGIS.app/Contents/Resources/python/plugins/processing/algs
7. Delete the "saga" folder in "algs"
8. Paste in the "saga" folder from your desktop (or wherever you stashed the 2.14 saga folder)
9. Start up QGIS and see if it worked. Both vector and raster operations work for me.