Opened 11 months ago

Last modified 11 months ago

#68940 assigned enhancement

qgis3 @3.34.1_1 +grass: default GRASS GISBASE path not correct and error message not helpful

Reported by: bal-agates Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: qgis3 grass GISBASE Cc: Veence (Vincent), nilason (Nicklas Larsson)
Port: qgis3 qgis3-ltr

Description

I had trouble getting the GRASS plugin to work in QGIS. After enabling the GRASS 8 plugin there was an error:

GRASS init error: GRASS was not found in '/opt/local/bin' (GISBASE), provider and plugin will not work.

Opening Plugins > GRASS > GRASS Options > General I saw my installed GRASS Version (it seemed to find the executable) but at the bottom was a message:

Currently selected GRASS installation is not valid

The default GISBASE was /opt/local/bin. That makes sense to me because that is where the GRASS startup executable lives, however, that may not be what QGIS needs? The large suite of scripts that make up GRASS live elsewhere.

I dug into the QGIS 3.43.1 code and the function that generated the message above was looking for the existence of a file $(GISBASE)/etc/element_list. On my system I found that file in /opt/local/lib/grass83/etc/element_list. In the dialog setting "Custom = /opt/local/lib/grass83" seems to fix the problem. It at least got rid of the error. I have not run any GRASS functions yet.

I am unsure of how to fix this in general. The Portfile effectively sets a variable "grass_gis_base = /opt/local/bin/grass". Is that where the default GISBASE is coming from? Would changing that to "/opt/local/lib/grass83" be a valid solution? If so how would you get that path, with GRASS version, in this portfile? Another possible solution would be to just display a note to the user to manually check the GISBASE path? Such a note would have saved me hours of troubleshooting.

Note that the same problem exists in QGIS3-LTR 3.28.13.

Also note the QGIS master source branch has a recent change, not included in QGIS 3.34.1, to the function that checks the validity of GISBASE. I am not sure when that will be incorporated into a release or if it would have any impact on this.

Change History (7)

comment:1 Changed 11 months ago by nilason (Nicklas Larsson)

Cc: nilason added

comment:2 Changed 11 months ago by nilason (Nicklas Larsson)

GISBASE should be by default /opt/local/lib/grass83 (it is for me). I'm not sure how that came to be /opt/local/bin for you. What gives :

otool -L /Applications/MacPorts/QGIS3.app/Contents/Frameworks/qgisgrass8.framework/Versions/3.34/qgisgrass8

?

comment:3 Changed 11 months ago by bal-agates

I may have jumped to a bad conclusion. I didn't look close enough to what the following Portfile line was doing

set grass_gis_base      [exec ${prefix}/bin/grass --config path]

Manually executing

$ /opt/local/bin/grass --config path
/opt/local/lib/grass83

This makes sense. My problem was likely caused by the following in my ~/Library/Application Support/QGIS/QGIS3/profiles/default/qgis.org/QGIS3.ini

gidbase\customDir=/opt/local/lib/grass83
customEnvVars="overwrite|GISBASE=/opt/local/bin", "overwrite|PATH=/opt/local/bin:/usr/bin:/usr/sbin:/sbin"

The first line is what I just changed to make it work. The first half of the second line is what was causing the problem. I do not remember changing that but it likely was years ago and on a different computer. Something that got copied over with a file migration between computers?

I think you can close this issue. Sorry for troubling you.

Here is the other output you requested.

$ otool -L /Applications/MacPorts/QGIS3.app/Contents/Frameworks/qgisgrass8.framework/Versions/3.34/qgisgrass8
/Applications/MacPorts/QGIS3.app/Contents/Frameworks/qgisgrass8.framework/Versions/3.34/qgisgrass8:
	@executable_path/../Frameworks/qgisgrass8.framework/qgisgrass8 (compatibility version 3.34.1, current version 3.34.1)
	/opt/local/lib/grass83/lib/libgrass_gis.8.3.dylib (compatibility version 8.3.0, current version 8.3.0)
	/opt/local/lib/grass83/lib/libgrass_vector.8.3.dylib (compatibility version 8.3.0, current version 8.3.0)
	/opt/local/lib/grass83/lib/libgrass_raster.8.3.dylib (compatibility version 8.3.0, current version 8.3.0)
	/opt/local/lib/grass83/lib/libgrass_imagery.8.3.dylib (compatibility version 8.3.0, current version 8.3.0)
	/opt/local/lib/grass83/lib/libgrass_dbmibase.8.3.dylib (compatibility version 8.3.0, current version 8.3.0)
	/opt/local/lib/grass83/lib/libgrass_dbmiclient.8.3.dylib (compatibility version 8.3.0, current version 8.3.0)
	/opt/local/lib/grass83/lib/libgrass_gproj.8.3.dylib (compatibility version 8.3.0, current version 8.3.0)
	@loader_path/../../../qgis_gui.framework/qgis_gui (compatibility version 3.34.1, current version 3.34.1)
	@loader_path/../../../qgis_core.framework/qgis_core (compatibility version 3.34.1, current version 3.34.1)
	/opt/local/lib/libgdal.34.dylib (compatibility version 34.0.0, current version 34.3.8)
	/opt/local/lib/libtasn1.6.dylib (compatibility version 13.0.0, current version 13.3.0)
	/opt/local/libexec/qt5/lib/QtXml.framework/Versions/5/QtXml (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtConcurrent.framework/Versions/5/QtConcurrent (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets (compatibility version 5.9.0, current version 5.9.2)
	/opt/local/libexec/qt5/lib/QtWebKit.framework/Versions/5/QtWebKit (compatibility version 5.9.0, current version 5.9.2)
	/opt/local/libexec/qt5/lib/libqca-qt5.2.dylib (compatibility version 2.0.0, current version 2.3.4)
	/opt/local/lib/libqt5keychain.1.dylib (compatibility version 1.0.0, current version 0.13.2)
	/opt/local/lib/libgeos_c.1.dylib (compatibility version 1.0.0, current version 1.18.1)
	/opt/local/lib/libspatialindex.6.dylib (compatibility version 6.0.0, current version 6.1.1)
	/opt/local/lib/libexpat.1.dylib (compatibility version 10.0.0, current version 10.10.0)
	/opt/local/lib/libzip.5.dylib (compatibility version 5.0.0, current version 5.5.0)
	/opt/local/lib/libprotobuf-lite.32.dylib (compatibility version 32.0.0, current version 3.21.12)
	/opt/local/lib/libexiv2.27.dylib (compatibility version 27.0.0, current version 0.27.6)
	/opt/local/lib/proj9/lib/libproj.25.dylib (compatibility version 25.0.0, current version 25.9.3)
	/opt/local/lib/libdraco.8.dylib (compatibility version 8.0.0, current version 8.0.0)
	/opt/local/libexec/qt5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/lib/libspatialite.8.dylib (compatibility version 10.0.0, current version 10.0.0)
	/opt/local/lib/libminizip.1.dylib (compatibility version 2.0.0, current version 2.0.0)
	/opt/local/lib/librttopo.1.dylib (compatibility version 3.0.0, current version 3.0.0)
	/opt/local/lib/libfreexl.1.dylib (compatibility version 4.0.0, current version 4.0.0)
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.3.0)
	/opt/local/lib/libxml2.2.dylib (compatibility version 14.0.0, current version 14.5.0)
	/opt/local/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.61.1)
	/opt/local/lib/libzstd.1.dylib (compatibility version 1.0.0, current version 1.5.5)
	/opt/local/lib/libpdalcpp.16.dylib (compatibility version 16.0.0, current version 16.0.0)
	/opt/local/libexec/qt5/lib/QtSerialPort.framework/Versions/5/QtSerialPort (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtPositioning.framework/Versions/5/QtPositioning (compatibility version 5.15.0, current version 5.15.11)
	@loader_path/../../../qgis_native.framework/qgis_native (compatibility version 3.34.1, current version 3.34.1)
	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 64.0.0, weak)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 2202.0.0, weak)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0, weak)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2487.30.104, weak)
	/opt/local/libexec/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.15.0, current version 5.15.11)
	/System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 341.35.0)
	/opt/local/libexec/qt5/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.15.0, current version 5.15.11)
	/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
	/opt/local/libexec/qt5/lib/qwt.framework/Versions/6/qwt (compatibility version 6.1.0, current version 6.1.6)
	/opt/local/libexec/qt5/lib/libqscintilla2_qt5.15.dylib (compatibility version 15.1.0, current version 15.1.1)
	/opt/local/libexec/qt5/lib/QtQuickWidgets.framework/Versions/5/QtQuickWidgets (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtQmlModels.framework/Versions/5/QtQmlModels (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtQml.framework/Versions/5/QtQml (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtMultimediaWidgets.framework/Versions/5/QtMultimediaWidgets (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtMultimedia.framework/Versions/5/QtMultimedia (compatibility version 5.15.0, current version 5.15.11)
	/opt/local/libexec/qt5/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.15.0, current version 5.15.11)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1600.157.0)

comment:4 in reply to:  3 Changed 11 months ago by nilason (Nicklas Larsson)

Replying to bal-agates:

I may have jumped to a bad conclusion. I didn't look close enough to what the following Portfile line was doing

set grass_gis_base      [exec ${prefix}/bin/grass --config path]

I know, I wrote that line :).

This makes sense. My problem was likely caused by the following in my ~/Library/Application Support/QGIS/QGIS3/profiles/default/qgis.org/QGIS3.ini

gidbase\customDir=/opt/local/lib/grass83
customEnvVars="overwrite|GISBASE=/opt/local/bin", "overwrite|PATH=/opt/local/bin:/usr/bin:/usr/sbin:/sbin"

The first line is what I just changed to make it work. The first half of the second line is what was causing the problem. I do not remember changing that but it likely was years ago and on a different computer. Something that got copied over with a file migration between computers?

It was actually my first thought, to test with a new QGIS user profile, but great you found the culprit.

I think you can close this issue. Sorry for troubling you.

I have no access to close, if you have, please go ahead. No worries, feel free to cc me next time.

comment:5 Changed 11 months ago by bal-agates

Owner: set to bal-agates
Status: newassigned

comment:6 Changed 11 months ago by bal-agates

Owner: bal-agates deleted

comment:7 Changed 11 months ago by bal-agates

I do not see a way I can close this issue. I haven't been able to find any documentation that describes how to close an issue. I thought maybe by assigning the issue to myself, the reporter, I would be able to close it but that didn't help. Now the "assigned to" and state might be messed up. Maybe only owners and super users can close an issue? Can someone point me to some documentation on the trac process.

Note: See TracTickets for help on using tickets.