Bug report #17555

Problem with GRASS in Processing plugin

Added by Michal Jurewicz over 6 years ago. Updated about 6 years ago.

Status:Closed
Priority:Normal
Assignee:Victor Olaya
Category:Processing/GRASS
Affected QGIS version:master Regression?:No
Operating System:MacOS Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:25452

Description

I just installed QGIS 2.99 master and GRASS7 using homebrew formula. Everything worked fine until I add path to GRASS in Processing option. After I did it, I can't open QGIS with working processing plugin. During opening QGIS there is an error as below. I used GRASS path like this: /usr/local/opt/grass7/grass-base

---
Couldn't load plugin 'processing' due to an error when calling its initGui() method

PermissionError: [Errno 13] Permission denied: '/usr/local/opt/grass7/grass-base/etc/colors/grass'
Traceback (most recent call last):
File "/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 345, in startPlugin
plugins[packageName].initGui()
File "/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/ProcessingPlugin.py", line 179, in initGui
self.toolbox = ProcessingToolbox()
File "/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/gui/ProcessingToolbox.py", line 95, in init
self.fillTree()
File "/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/gui/ProcessingToolbox.py", line 319, in fillTree
self.fillTreeUsingProviders()
File "/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/gui/ProcessingToolbox.py", line 384, in fillTreeUsingProviders
providerItem = TreeProviderItem(provider, self.algorithmTree, self)
File "/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/gui/ProcessingToolbox.py", line 515, in init
self.setToolTip(0, self.provider.longName())
File "/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py", line 125, in longName
version = Grass7Utils.installedVersion()
File "/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/grass7/Grass7Utils.py", line 115, in installedVersion
startupinfo=si if isWindows() else None
File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in init
restore_signals, start_new_session)
File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/usr/local/opt/grass7/grass-base/etc/colors/grass'

Wersja Pythona: 3.6.3 (default, Nov 26 2017, 09:17:50) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.38)]
Wersja QGIS: 2.99.0-Master Master, 7451422

Lokalizacja Pythona:
/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing
/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python
/Users/michaljurewicz/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/michaljurewicz/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins
/usr/local/opt/gdal2-python/lib/python3.6/site-packages
/usr/local/opt/qgis3-dev/lib/python3.6/site-packages
/usr/local/opt/qgis3-dev/libexec/python/lib/python/site-packages
/usr/local/lib/python3.6/site-packages
/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python36.zip
/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6
/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload
/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
/usr/local/Cellar/numpy/1.13.3/libexec/nose/lib/python3.6/site-packages
/Users/michaljurewicz/Library/Application Support/QGIS/QGIS3/profiles/default/python
---

Grass7Utils.py Magnifier - Debugging Grass7Utils.py (21.2 KB) Médéric RIBREUX, 2018-01-07 11:48 AM

Grass7Utils.py Magnifier (20.8 KB) William Kyngesburye, 2018-03-23 02:52 AM

History

#1 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Open to Feedback
  • Priority changed from High to Normal
  • Crashes QGIS or corrupts data changed from Yes to No
  • Regression? changed from Yes to No

error seems clear, or not?

PermissionError: [Errno 13] Permission denied: '/usr/local/opt/grass7/grass-base/etc/colors/grass'

#2 Updated by Gary Sherman over 6 years ago

Giovanni Manghi wrote:

error seems clear, or not?

PermissionError: [Errno 13] Permission denied: '/usr/local/opt/grass7/grass-base/etc/colors/grass'

The file is not a binary or script. It is a plain text file not meant to be executed. For some reason the plugin thinks that is the path to the grass executable/script.

#3 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Feedback to Open

#4 Updated by Nyall Dawson over 6 years ago

  • Status changed from Open to Feedback

What's the correct grass command on your platform?

#5 Updated by Gary Sherman over 6 years ago

grass72

  • Homebrew installs grass7 in: /usr/local/opt/grass7
  • /usr/local/opt/grass7/grass-base is a symlink to /usr/local/opt/grass7/grass-7.2.2
  • The grass72 shell script is in /usr/local/opt/grass7/bin/grass72
  • /usr/local/opt/grass7/grass-base contains grass.sh and grass72.sh
  • /usr/local/opt/grass7/grass-base/bin contains all the grass function executables (e.g. r.in.gdal, v.in.ogr)
  • which grass72 returns: /usr/local/bin/grass72

#6 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Feedback to Open

#7 Updated by Médéric RIBREUX over 6 years ago

Hello,

I don't have a Mac to test... Perhaps this is the GRASS detection code that doesn't do the right thing.

Could you temporarily:
- use a QGIS version from this PR (perhaps not necessary).
- replace your Grass7Utils.py (it should be in your QGIS installation in shared/python/plugins/processing/algs/grass7/ directory) with the more verbose one provided here and give us the results of the 'DEBUG' log ?

#8 Updated by William Kyngesburye about 6 years ago

I see what's going on - in searchFolder(), when the command is found, the "break" statement only breaks the cmd loop, so it then moves on to the next folder in the walking, eventually leaving the last command found, which happens to be in the etc/colors subfolder, instead of the first one found at the top level of the grasspath.

The walk loop also needs a break if command is not None. I attached my Grass7Utils.py with this extra break. I don't know if this will break the Windows search.

#9 Updated by Nyall Dawson about 6 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

Fixed in master/3.0

Also available in: Atom PDF