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

Proj.db not found for GDAL tools on QGIS 3.16 Mac all-in-one installer #39801

Closed
spatialthoughts opened this issue Nov 4, 2020 · 19 comments
Closed
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! macOS Processing Relating to QGIS Processing framework or individual Processing algorithms Regression Something which used to work, but doesn't anymore

Comments

@spatialthoughts
Copy link
Contributor

gdalwarp give an error on QGIS3.16 Mac because it can't find proj.db. Same operation works fine in QGIS3.10 LTR package.

"ERROR 1: PROJ: proj_create_from_database: Cannot find proj.db"

proj_error

To reproduce

  1. Unzip and Load Attached SRTM raster N27E086.hgt.zip
    2.Processing -> Toolbox -> Warp (reproject)
  2. Set 'Target CRS' as 'EPSG:32645' and click 'Run'.
  3. Operation fails.

QGIS and OS versions

QGIS version 3.16.0-Hannover QGIS code revision 33475aa
Compiled against Qt 5.14.2 Running against Qt 5.14.2
Compiled against GDAL/OGR 3.1.2 Running against GDAL/OGR 3.1.2
Compiled against GEOS 3.8.1-CAPI-1.13.3 Running against GEOS 3.8.1-CAPI-1.13.3
Compiled against SQLite 3.31.1 Running against SQLite 3.31.1
PostgreSQL Client Version 12.3 SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.4
Compiled against PROJ 6.3.2 Running against PROJ Rel. 6.3.2, May 1st, 2020
OS Version macOS 10.15
Active python plugins ORStools; slyr_community; QuickOSM; ee_plugin; profiletool; DataPlotly; quick_map_services; pathfinder; qdraw; minimal; GeoCoding; pluginbuilder3; show_time; latlontools; Qgis2threejs; qgsAzimuth; plugin_reloader; Mergin; processing; db_manager
@spatialthoughts spatialthoughts added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Nov 4, 2020
@gioman gioman added Regression Something which used to work, but doesn't anymore macOS Processing Relating to QGIS Processing framework or individual Processing algorithms labels Nov 5, 2020
@gioman
Copy link
Contributor

gioman commented Nov 5, 2020

Confirmed here too on Catalina.

@spatialthoughts
Copy link
Contributor Author

@PeterPetrik This is a pretty serious regression and would be good to fix this for the next point release.

@PeterPetrik
Copy link
Contributor

@spatialthoughts . where do you have your application installed? have you relocated it?

@spatialthoughts
Copy link
Contributor Author

Installed in Applications. Haven't renamed or moved it. Screenshot attached.
qgis

@PeterPetrik
Copy link
Contributor

@spatialthoughts as a workaround, can you please open qgis python console and type

import os
os.environ["PROJ_LIB"]="/Applications/QGIS.app/Contents/Resources/proj"

and retry to run the algorithm?

@spatialthoughts
Copy link
Contributor Author

Thanks. That Works. Will use the workaround for now. Hopefully, it's an easy fix for the next release.

@PeterPetrik
Copy link
Contributor

i can think of two ways... do you use these algorithms directly (without qgis/processing)? one solution would allow it too, other one will not...

@spatialthoughts
Copy link
Contributor Author

By directly, you mean running gdalwarp on the command line? I do that occasionally, but if that doesn't work there are ways to install those tools via other means or set an environment variable like here. Making it work via processing toolbox without any workarounds would be the top priority for me.

@PeterPetrik
Copy link
Contributor

because I can either set PROJ_LIB in qgis environment (works only from QGIS) or create a wrapper bash script for every GDAL binary (will work from command line too)

@spatialthoughts
Copy link
Contributor Author

It would be awesome to get it working properly everywhere. Is it possible to roll out the simple fix (proj_lib in qgis) for 3.16.1 and work towards the global fix for a later release?

@PeterPetrik
Copy link
Contributor

@spatialthoughts can you try in tomorrow's nightly build? should be fixed "correctly" so it should work from command line too

@mizraith
Copy link

mizraith commented Feb 8, 2022

@spatialthoughts as a workaround, can you please open qgis python console and type

import os
os.environ["PROJ_LIB"]="/Applications/QGIS.app/Contents/Resources/proj"

and retry to run the algorithm?

Just ran into this problem under Monterey and QGIS 3.22.2-Bialowieza Trying to merge about 9 layers. Can confirm that the above appears to work and make the error message go away.

So....this is still an issue a few years later (or it came back)

@visaviweb
Copy link

this is still an issue with QGIS 3.24.0-Tisler

@Rikuoja
Copy link

Rikuoja commented May 25, 2022

Having the same problem with all 3.22 versions, including LTR.

"PROJ_LIB" env variable is not set in QGIS python console. All other GDAL env variables seem to be correctly set.

os.environ
environ({'USER': 'riku', '__CFBundleIdentifier': 'org.qgis.qgis3', 'COMMAND_MODE': 'unix2003', 'LOGNAME': 'riku', 'PATH': '/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/Applications/QGIS-LTR.app/Contents/MacOS/bin:/usr/bin:/bin:/usr/sbin:/sbin', 'PYQGIS_STARTUP': 'pyqgis-startup.py', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.ukED6bKMHa/Listeners', 'SHELL': '/bin/zsh', 'HOME': '/Users/riku', 'QT_AUTO_SCREEN_SCALE_FACTOR': '1', '__CF_USER_TEXT_ENCODING': '0x1F5:0x0:0x11', 'TMPDIR': '/var/folders/z6/ld52r6fn1dv_1h70k7z7d9n40000gn/T/', 'XPC_SERVICE_NAME': 'application.org.qgis.qgis3.21928270.21929400', 'XPC_FLAGS': '0x0', 'GDAL_DRIVER_PATH': '/Applications/QGIS-LTR.app/Contents/MacOS/lib/gdalplugins', 'GDAL_DATA': '/Applications/QGIS-LTR.app/Contents/Resources/gdal', 'PYTHONHOME': '/Applications/QGIS-LTR.app/Contents/MacOS', 'GDAL_PAM_PROXY_DIR': '/Users/riku/Library/Application Support/QGIS/QGIS3/profiles/raster_plugin/gdal_pam/', 'LC_CTYPE': 'UTF-8', 'SSL_CERT_DIR': '/Applications/QGIS-LTR.app/Contents/Resources/certs', 'SSL_CERT_FILE': '/Applications/QGIS-LTR.app/Contents/Resources/certs/certs.pem', 'DYLD_LIBRARY_PATH': '/Applications/QGIS-LTR.app/Contents/MacOS/lib'})

@Spartacus1
Copy link

Spartacus1 commented Oct 3, 2022

Same here using Monterey and QGIS 3.26.3.

@brentnk
Copy link

brentnk commented Oct 12, 2022

I am having this same issue. 3.26.3 on Monterey 12.6.

i can think of two ways... do you use these algorithms directly (without qgis/processing)? one solution would allow it too, other one will not...

This seems to fix it.

@bholtdwyer
Copy link

bholtdwyer commented Nov 15, 2022

I'm having this same problem when I try the Raster > Merge command on QGIS 3.22.8 on Mac OS 10.15.7.

--Edit: Fixed; problem is path to app is different for more recent QGIS:
os.environ["PROJ_LIB"]="/Applications/QGIS-LTR.app/Contents/Resources/proj"

By the way, is there any way to update the Proj that QGIS uses? Mine seems to be using version 3 whereas the current version is 9.

@malo6008
Copy link

I' m having the same issue on QGIS 3.28 LTR with MacOS 14.0.
The above mentioned work-around solves the issue, but the next time I use QGIS the environment variable seems to be gone again.
How can I make this work-around persistent?

@CommunyAS
Copy link

CommunyAS commented Nov 23, 2023

The problem still exists in QGIS-LTR 3.28.12-Firenze on macOS 13.6.

The solution suggested above in #39801 (comment) does not work - at least for QGIS-LTR, since it will be installed as QGIG-LTR.app. The path must probably be adjusted accordingly (though I did not try using QGIS Python console)

There is another solution:

In QGIS Options you can specify the correct path under System > Environment by overwriting the PROJ_LIB variabel with the correct path (restart required) - see screenshot below:

QGIS_custom_environment

This will fix the problem perhaps more permanently.

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! macOS Processing Relating to QGIS Processing framework or individual Processing algorithms Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

No branches or pull requests