Opened 3 years ago

Closed 19 months ago

#64537 closed defect (fixed)

qgis3 @3.22.2_0+grass+postgresql13+python39: error gdalwarp missing or insufficient permissions

Reported by: bal-agates Owned by: Veence (Vincent)
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: Cc:
Port: qgis3

Description

When running Raster > Extraction > Clip Raster by Mask Layer I am getting the following error:

QGIS version: 3.22.2-Białowieża
Qt version: 5.15.2
Python version: 3.9.10
GDAL version: 3.4.0
GEOS version: 3.10.1-CAPI-1.16.0
PROJ version: Rel. 8.2.1, January 1st, 2022
PDAL version: 2.3.0 (git-version: Release)
Algorithm started at: 2022-01-26T16:08:10
Algorithm 'Clip raster by mask layer' starting…
Input parameters:
{ 'ALPHA_BAND' : False, 'CROP_TO_CUTLINE' : True, 'DATA_TYPE' : 0, 'EXTRA' : '', 'INPUT' : '/Users/brett/GIS/DEM/AZ/AZ-Bouse/USGS_13_n34w115_20211215.tif', 'KEEP_RESOLUTION' : False, 'MASK' : '/Users/brett/qgisdata/AZ/Data/azgs_dgm_107/Shapefiles/bouse_extent.shp', 'MULTITHREADING' : False, 'NODATA' : None, 'OPTIONS' : '', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'SET_RESOLUTION' : False, 'SOURCE_CRS' : None, 'TARGET_CRS' : None, 'X_RESOLUTION' : None, 'Y_RESOLUTION' : None }

GDAL command:
gdalwarp -overwrite -of GTiff -cutline /Users/brett/qgisdata/AZ/Data/azgs_dgm_107/Shapefiles/bouse_extent.shp -cl bouse_extent -crop_to_cutline /Users/brett/GIS/DEM/AZ/AZ-Bouse/USGS_13_n34w115_20211215.tif /private/var/folders/5z/18s4yhbx4zj7lw9zq0h8gqym0000gn/T/processing_bgrVLE/76575832d3e445f9a817631801f721c8/OUTPUT.tif
GDAL command output:
Process gdalwarp failed to start. Either gdalwarp is missing, or you may have insufficient permissions to run the program.
Execution failed after 0.02 seconds

Loading resulting layers
Algorithm 'Clip raster by mask layer' finished

The error message seems to imply that QGIS is trying to run gdalwarp as a shell command? I have verified that I have gdalwarp installed and that it runs from the command line:

$ ll /opt/local/bin/gdalwarp
16 -rwxr-xr-x  1 root  admin  88629 Jan 20 19:55 /opt/local/bin/gdalwarp
$ gdalwarp --version
GDAL 3.4.0, released 2021/11/04

With this version of QGIS3 I was able to import a GeoTIFF which I assume uses some GDAL functions or commands.

In QGIS3 > Preferences >Environment I see

  • GISBASE = /opt/local/bin

In QGIS3 > Preferences >Current Environment variables I see [Readonly - Bold which seems to indicates modified at startup]

  • PATH = /usr/bin:/bin:/usr/sbin:/sbin: [Bold]
  • GISBASE = /opt/local/bin [Bold]

Probably not helpful but I used QGIS3 > Plugins > Python Console and ran

>>> print(os.environ['PATH'])
/usr/bin:/bin:/usr/sbin:/sbin

When QGIS3 tries to run gdalwarp is it using GISBASE or PATH or a concatenation of both for the command path?

I checked QGIS permissions in Apple > System Preferences > Security & Privacy > Files and Folders it had all options enabled. I even tried an experiment where I added QGIS3 to Apple > System Preferences > Security & Privacy > Full Disk Access.

I do not know how to verify what $PATH QGIS3 uses when it executes gdalwarp (assuming it is trying to execute a shell command version).

I have considered the possibility the error message is misleading. Could gdalwarp have been found and run but it generated an error that wasn't handled well?

MacPort configuration problem or QGIS3 problem? I did a quick scan of QGIS issues and didn't see anything that is an obvious match.

I am running on a macOS 12.1, arm64 and a few days ago I did a "port upgrade outdated". I have done something similar on earlier versions without problems but cannot remember when. Maybe not on my macOS 12/arm64 computer? Versions

QGIS version
3.22.2-Białowieża
QGIS code branch
Release 3.22
Qt version
5.15.2
Python version
3.9.10
GDAL/OGR version
3.4.0
PROJ version
8.2.1
EPSG Registry database version
v10.041 (2021-12-03)
GEOS version
3.10.1-CAPI-1.16.0
SQLite version
3.37.2
PDAL version
2.3.0
PostgreSQL client version
13.5
SpatiaLite version
5.0.1
QWT version
6.1.6
QScintilla2 version
2.13.1
OS version
macOS 12.1

Active Python plugins
QuickOSM
2.0.0
latlontools
3.5.9
processing
2.12.99
sagaprovider
2.12.99
grassprovider
2.12.99
db_manager
0.1.20
MetaSearch
0.3.5

Change History (4)

comment:1 Changed 3 years ago by bal-agates

Update. I was able to workaround the above problem by making the following change:

In QGIS > Preferences > System > Environment

  • verified "Use custom variables" is checked
  • already had "Overwrite, GISBASE = /opt/local/bin"
  • added "Overwrite, PATH = /opt/local/bin:/usr/bin:/usr/sbin:/sbin"

The above new PATH is concat of GISBASE and original PATH.

Quit GIS and restarted. Now my "Clip Raster by Mask Layer" worked with no error.

I looked on another computer with QGIS 3.16.4 (macOS 10.13, x86_64) that was likely from a pre-built installer (not from MacPorts). It did not have GISBASE and initially it had

PATH="/usr/bin:/bin:/usr/sbin:/sbin"

but after running "Clip Raster by Mask Layer" the

PATH="/Applications/QGIS-3.16.4-app/Contents/MacOS/bin:/usr/bin:/bin:/usr/sbin:/sbin"

The the programs path variable was modified by running the command. Keep in mind this is a different version of QGIS3 than I reported the problem with. I am not sure the current QGIS 3.22.2 should behave similarly but it might give some clues.

comment:2 Changed 3 years ago by bal-agates

Another piece of relevant information. I stumbled on a note I wrote to myself on 03-Dec-2021 regarding my installation of QGIS 3.22.0 where I added Environment GISBASE = /opt/local/bin. I suspect I found that suggestion somewhere on the Internet for fixing a startup error. That setting might have been preserved in my current installation of QGIS 3.22.2. In other words, I could have GISBASE where a fresh install would not.

I believe the original report above is still an issue.

comment:3 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: qgis3 gdalwarp clip raster removed
Owner: set to Veence
Status: newassigned

comment:4 Changed 19 months ago by nilason <n_larsson@…>

Resolution: fixed
Status: assignedclosed

In e41f8a90ae51be0e3bdcae4cec9728d48a94961a/macports-ports (master):

qgis3: Update to 3.28.6 with new PROJ and GRASS variants

  • grass (latest) variant is added
  • proj[N] variants are now selectable
  • livecheck now checks for latest long-term-release (LTR)

Closes: #64537

Note: See TracTickets for help on using tickets.