GRASS GIS – Resolving Issues with GRASS Not Working in QGIS

grassqgis-grass-plugin

*Running QGIS 3.6, GRASS 7.6; have both Python 2 and 3

I'm trying to run a GRASS algorithm in QGIS, and none of the GRASS tools are working. GRASS also isn't working in the standalone version. I have tried both QGIS and QGIS with GRASS.

I tried changing the name of my Python 3.7 path as that has caused issues in the past, and got this error when running in QGIS:

This algorithm cannot be run 🙁 The specified GRASS 7 folder
"C:\Program Files\QGIS 3.6\bin\bin" does not contain a valid set of GRASS 7 modules.
Please, go to the Processing settings dialog, and check that the GRASS
7 folder is correctly configured

When I run GRASS independently (for 7.4 and 7.6), the command line opens with the following error:

File "C:\Python37\Lib\site.py", line 177
  file=sys.stderr)
SyntaxError: invalid syntax
Press any key to continue . . .

Running grass within QGIS (v.clean tool):

The following layers were not correctly
generated. [….] You can check the
'Log Messages Panel' in QGIS main window to find more information
about the execution of the algorithm.

There is nothing substantial in Log Messages, but looking through the GRASS log I found the same thing I was getting when trying to run GRASS standalone:

File "C:\Python37\Lib\site.py", line 177
file=sys.stderr)
^
SyntaxError: invalid syntax
Press any key to continue . . .

I checked my processing options: GRASS is activated and the docs are in the proper location.

I also tried looking for any errors around the 'syntax error' in Python37\Lib\site.py, as well as a couple of GRASS .bat files, but I don't know enough about using GRASS to actually tell if anything is wrong.

Best Answer

Note that GRASS GIS 7.4 and 7.6 only work with Python 2. We are close to a full update to Python 3 which is done in the current development version GRASS GIS 7.7 (to become 7.8 stable then).

If possible for you, consider to update to GRASS GIS 7.7 (AFAIK it is available in the OSGeo4W installer, under development section).

Edit Sep 2019:

GRASS GIS 7.8.0 with Python 3 support as been released:

Related Question