Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processing: GRASS r.drain fails on macOS: "No module named site", "Raster not found" #36126

Closed
e42mercury opened this issue May 1, 2020 · 2 comments
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers macOS Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@e42mercury
Copy link

This issue seems to be back. I'm running mac OS 10.13.6 and QGIS 3.12.2. Another report of something very similar is here.
GRASS tools (on mac at least) seem to have often had path problems that occasionally work and then in updates, break again (for example, see this bug report). In 3.12, r.walk works fine, but r.drain seems to create temporary rasters but then can't find them again. For the start point, I have tried a shapefile and a coordinate, which was an issue in earlier versions, but the result is the same error. It looks like the tool runs in GRASS, but this error happens twice:

ImportError: No module named site
ERROR: Raster map <output52fba189f3314041a68e695b68431f67> not found
ERROR: Raster map or group <output52fba189f3314041a68e695b68431f67> not found
ERROR: Vector map <drain52fba189f3314041a68e695b68431f67> not found

Below is the full log.

QGIS version: 3.12.2-București
QGIS code revision: 8a1fb33634
Qt version: 5.12.3
GDAL version: 2.4.1
GEOS version: 3.7.2-CAPI-1.11.2 b55d2125
PROJ version: Rel. 5.2.0, September 15th, 2018
Processing algorithm…
Algorithm 'r.drain' starting…
Input parameters:
{ '-a' : False, '-c' : False, '-d' : True, '-n' : False, 'GRASS_MIN_AREA_PARAMETER' : 0.0001, 'GRASS_OUTPUT_TYPE_PARAMETER' : 0, 'GRASS_RASTER_FORMAT_META' : '', 'GRASS_RASTER_FORMAT_OPT' : '', 'GRASS_REGION_CELLSIZE_PARAMETER' : 0, 'GRASS_REGION_PARAMETER' : None, 'GRASS_SNAP_TOLERANCE_PARAMETER' : -1, 'GRASS_VECTOR_DSCO' : '', 'GRASS_VECTOR_EXPORT_NOCAT' : False, 'GRASS_VECTOR_LCO' : '', 'direction' : '/Users/erik/Documents/QGIS/Diamante/Move Directions from LD-4.tif', 'drain' : 'TEMPORARY_OUTPUT', 'input' : '/Users/erik/Documents/QGIS/Diamante/Cost surface from LD-4 hours.tif', 'output' : 'TEMPORARY_OUTPUT', 'start_coordinates' : None, 'start_points' : '/Users/erik/Documents/QGIS/Diamante/LD-4.shp' }

g.proj -c proj4="+proj=longlat +datum=WGS84 +no_defs"
r.in.gdal input="/Users/erik/Documents/QGIS/Diamante/Cost surface from LD-4 hours.tif" band=1 output="rast_5eac3c8ebd1f35" --overwrite -o
r.in.gdal input="/Users/erik/Documents/QGIS/Diamante/Move Directions from LD-4.tif" band=1 output="rast_5eac3c8ebd3976" --overwrite -o
v.in.ogr min_area=0.0001 snap=-1.0 input="/Users/erik/Documents/QGIS/Diamante/LD-4.shp" output="vector_5eac3c8ebd5887" --overwrite -o
g.region n=-33.818067018 s=-34.798218824 e=-69.038583857 w=-71.236042704 res=0.0002694945851116008
r.drain input=rast_5eac3c8ebd1f35 direction=rast_5eac3c8ebd3976 start_points=vector_5eac3c8ebd5887 -d output=output52fba189f3314041a68e695b68431f67 drain=drain52fba189f3314041a68e695b68431f67 --overwrite
g.region raster=output52fba189f3314041a68e695b68431f67
r.out.gdal -t -m input="output52fba189f3314041a68e695b68431f67" output="/private/var/folders/nj/gkbf_4l131x1x3yzwtbq96y80000gn/T/processing_BOxdqI/fc5c20acce2649449811cc7401de1a46/output.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
v.out.ogr type="auto" input="drain52fba189f3314041a68e695b68431f67" output="/private/var/folders/nj/gkbf_4l131x1x3yzwtbq96y80000gn/T/processing_BOxdqI/32493e9d44754ade84017f6a53dc2586/drain.gpkg" format="GPKG" --overwrite
Starting GRASS GIS...
Executing </private/var/folders/nj/gkbf_4l131x1x3yzwtbq96y80000gn/T/processing_BOxdqI/grassdata/grass_batch_job.sh> ...
Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default
Projection information updated
Over-riding projection check
Importing raster map <rast_5eac3c8ebd1f35>...
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
Over-riding projection check
Importing raster map <rast_5eac3c8ebd3976>...
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
Over-riding projection check
Check if OGR layer <LD-4> contains polygons...
0..100
Creating attribute table for layer <LD-4>...
Importing 1 features (OGR layer <LD-4>)...
0..100
-----------------------------------------------------
Building topology for vector map <vector_5eac3c8ebd5887@PERMANENT>...
Registering primitives...
ImportError: No module named site
ERROR: Raster map <output52fba189f3314041a68e695b68431f67> not found
ERROR: Raster map or group <output52fba189f3314041a68e695b68431f67> not found
ERROR: Vector map <drain52fba189f3314041a68e695b68431f67> not found
Execution of </private/var/folders/nj/gkbf_4l131x1x3yzwtbq96y80000gn/T/processing_BOxdqI/grassdata/grass_batch_job.sh> finished.
Traceback (most recent call last):
File "/Applications/QGIS3.12.app/Contents/Resources/grass7/bin/_grass76", line 2207, in <module>
main()
File "/Applications/QGIS3.12.app/Contents/Resources/grass7/bin/_grass76", line 2155, in main
clean_all()
File "/Applications/QGIS3.12.app/Contents/Resources/grass7/bin/_grass76", line 1789, in clean_all
gsetup.clean_default_db()
File "/Applications/QGIS3.12.app/Contents/Resources/grass7/etc/python/grass/script/setup.py", line 220, in clean_default_db
conn = gdb.db_connection()
File "/Applications/QGIS3.12.app/Contents/Resources/grass7/etc/python/grass/script/db.py", line 108, in db_connection
nuldev = file(os.devnull, 'w')
NameError: name 'file' is not defined
/Applications/QGIS3.12.app/Contents/Resources/grass7/grass76.sh: line 20: /private/var/folders/nj/gkbf_4l131x1x3yzwtbq96y80000gn/T/processing_BOxdqI/grassdata/temp_location/PERMANENT: is a directory
Starting GRASS GIS...
Executing </private/var/folders/nj/gkbf_4l131x1x3yzwtbq96y80000gn/T/processing_BOxdqI/grassdata/grass_batch_job.sh> ...
ERROR: Raster map <output52fba189f3314041a68e695b68431f67> not found
ERROR: Raster map or group <output52fba189f3314041a68e695b68431f67> not found
ERROR: Vector map <drain52fba189f3314041a68e695b68431f67> not found
Execution of </private/var/folders/nj/gkbf_4l131x1x3yzwtbq96y80000gn/T/processing_BOxdqI/grassdata/grass_batch_job.sh> finished.
Traceback (most recent call last):
File "/Applications/QGIS3.12.app/Contents/Resources/grass7/bin/_grass76", line 2207, in <module>
main()
File "/Applications/QGIS3.12.app/Contents/Resources/grass7/bin/_grass76", line 2155, in main
clean_all()
File "/Applications/QGIS3.12.app/Contents/Resources/grass7/bin/_grass76", line 1789, in clean_all
gsetup.clean_default_db()
File "/Applications/QGIS3.12.app/Contents/Resources/grass7/etc/python/grass/script/setup.py", line 220, in clean_default_db
conn = gdb.db_connection()
File "/Applications/QGIS3.12.app/Contents/Resources/grass7/etc/python/grass/script/db.py", line 108, in db_connection
nuldev = file(os.devnull, 'w')
NameError: name 'file' is not defined
/Applications/QGIS3.12.app/Contents/Resources/grass7/grass76.sh: line 20: /private/var/folders/nj/gkbf_4l131x1x3yzwtbq96y80000gn/T/processing_BOxdqI/grassdata/temp_location/PERMANENT: is a directory
Execution completed in 17.13 seconds
Results:
{'drain': <QgsProcessingOutputLayerDefinition {'sink':TEMPORARY_OUTPUT, 'createOptions': {'fileEncoding': 'System'}}>,
'output': <QgsProcessingOutputLayerDefinition {'sink':TEMPORARY_OUTPUT, 'createOptions': {'fileEncoding': 'System'}}>}

Loading resulting layers
The following layers were not correctly generated.<ul><li>/private/var/folders/nj/gkbf_4l131x1x3yzwtbq96y80000gn/T/processing_BOxdqI/32493e9d44754ade84017f6a53dc2586/drain.gpkg</li><li>/private/var/folders/nj/gkbf_4l131x1x3yzwtbq96y80000gn/T/processing_BOxdqI/fc5c20acce2649449811cc7401de1a46/output.tif</li></ul>You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.
@e42mercury e42mercury added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 1, 2020
@alexbruy alexbruy added the macOS label May 4, 2020
@gioman gioman changed the title GRASS r.drain fails in QGIS 3.12: "No module named site", "Raster not found" Processing/GRASS r.drain fails on macOS: "No module named site", "Raster not found" May 4, 2020
@gioman gioman added the Processing Relating to QGIS Processing framework or individual Processing algorithms label May 4, 2020
@gioman
Copy link
Contributor

gioman commented Jul 6, 2020

Confirmed no working on macOS on QGIS 3.10.7 on Catalina. Is working ok on Linux.

@gioman gioman changed the title Processing/GRASS r.drain fails on macOS: "No module named site", "Raster not found" Processing: GRASS r.drain fails on macOS: "No module named site", "Raster not found" Jul 7, 2020
@PeterPetrik PeterPetrik self-assigned this Jul 23, 2020
@PeterPetrik
Copy link
Contributor

The reported issue should be fixed by commit qgis/QGIS-Mac-Packager@218a571.
Can you please re-test if the issue persists with build: https://qgis.org/downloads/macos/nightly2/qgis_nightly2_master_20200917_044804.dmg

Note: Problems with GRASS processing provider in QGIS 3.10 and 3.14 were caused by complicated settings of PATHS, linker paths
and other settings in various GRASS and QGIS scripts/binaries (partially coming from homebrew builds). The GRASS (reliable) deployment
was one of the drivers for complete refactoring of QGIS dependencies used for MacOS builds
(see qgis/QGIS-Enhancement-Proposals#177).
Now we have full control of building and patching GRASS as needed. QGIS 3.16 release will be first using the new system,
you can test it in "nighlty2" builds (nightly are still based on "old" homebrew deps and QGIS 3.10 LTR will be released
with them). You can grab your nighly build in https://qgis.org/downloads/macos/nightly2/ and report problems in
https://github.com/qgis/QGIS-Mac-Packager or in this repository

@gioman gioman added the Feedback Waiting on the submitter for answers label Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers macOS Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

4 participants