2

Executing a GRASS command in QGIS 2.18.16 via Processing returns the error:

This algorithm cannot be run :-( It seems that GRASS is not correctly installed and configured in your system. Please install it before running GRASS algorithms.

The solutions provided at Cannot run Grass algorithms in QGIS 2.18 on Ubuntu 16.04 do not work for the following reasons.

  1. As a workaround, you may edit (as sudo) /usr/share/qgis/python/plugins/processing/algs/grass7/Grass7Utils.py line 251 to

        command = 'grass72 ' + Grass7Utils.grassMapsetFolder() \
    

I do not believe that line 251 is the correct location for this code. This area of code is between line 242 and 264.

    @staticmethod
    def writeGrass7Window(filename):
      out = open(filename, 'w')
      out.write('proj:       0\n')
      out.write('zone:       0\n')
      out.write('north:      1\n')
      out.write('south:      0\n')
      out.write('east:       1\n')
      out.write('west:       0\n')
      out.write('cols:       1\n')
      out.write('rows:       1\n')
      out.write('e-w resol:  1\n')
      out.write('n-s resol:  1\n')
      out.write('top:        1\n')
      out.write('bottom:     0\n')
      out.write('cols3:      1\n')
      out.write('rows3:      1\n')
      out.write('depths:     1\n')
      out.write('e-w resol3: 1\n')
      out.write('n-s resol3: 1\n')
      out.write('t-b resol:  1\n')
    out.close()
  1. I tried the second solution to add a soft link but that returned an error.

    sudo ln -s /usr/bin/grass72/usr/bin/grass70 ln: failed to create symbolic link './grass70': File exists

  2. I uninstalled GRASS, disconnected from the unstable ubuntu qgis repository and reinstalled GRASS but it reinstalls 7.2. There is no version 7.0 available at GRASS for download.

    How do I get GRASS to work within Processing using Ubuntu QGIS 2.18.16?

  • Keep in mind that the linked question is over a year old, the python scripts may have changed since then. Looking at ubuntugis unstable, I see they have Grass 7.4.0 by now, but QGIS is not yet ready for that. What OS version are you running? – AndreJ Feb 6 '18 at 17:45
  • @AndreJ. I am running Ubuntu 16.04. I have updated/edited my question. Thanks. – GBG Feb 6 '18 at 17:53
  • The main ubuntu repo has GRASS 7.0.3. Make sure to remove and purge your QGIS and GRASS 7.2, then remove the ubuntugis ppa from your sources, switch to qgis.org/debian trusty and run apt-cache policy grass to see what is available for you. – AndreJ Feb 7 '18 at 16:38

Your Answer

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

Browse other questions tagged or ask your own question.