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

RuntimeError: PROJ: proj_identify: Cannot find proj.db #1742

Closed
davemfish opened this issue Jan 21, 2025 · 0 comments · Fixed by #1745
Closed

RuntimeError: PROJ: proj_identify: Cannot find proj.db #1742

davemfish opened this issue Jan 21, 2025 · 0 comments · Fixed by #1745
Assignees
Labels
bug Something isn't working in progress This issue is actively being worked on
Milestone

Comments

@davemfish
Copy link
Contributor

Reported here and the full logfile is pasted below: https://community.naturalcapitalproject.org/t/issue-with-missing-output-folder-when-running-ndr-module-in-invest-model/5714/8

I was able to reproduce this by setting my PROJ_LIB and PROJ_DATA to erroneous values and then running NDR from the CLI.

We have a pyinstaller runtime hook to set PROJ_LIB:
os.environ['PROJ_LIB'] = os.path.join(sys._MEIPASS, 'proj')

But it seems that if PROJ_DATA also exists and is erroneous, then we'll get this RuntimeError anyway.

So I think if we also set PROJ_DATA in the runtime hook, we'll be okay:

os.environ['PROJ_DATA'] = os.path.join(sys._MEIPASS, 'proj')
os.environ['PROJ_LIB'] = os.path.join(sys._MEIPASS, 'proj')
Arguments for InVEST natcap.invest.ndr.ndr 3.14.3:
biophysical_table_path       E:\1论文水质净åŒæ•°æ�®å¤„ç�†\氮磷截留çŽ2.csv
calc_n                       True
calc_p                       True
dem_path                     E:\a大论文\gis处�过程\大论文图\DEM1.tif
k_param                      2
lulc_path                    E:\a大论文\flus\çŸæ€�ä¿�护 预æµ2035.tif
n_workers                    -1
results_suffix               
runoff_proxy_path            E:\2020zxl产水\2020Pr.ZH.tif
subsurface_critical_length_n 2
subsurface_eff_n             0.5
threshold_flow_accumulation  1000
watersheds_path              E:\a大论文\gis处�过程\大论文图\Watershed1.shp
workspace_dir                E:\2035çŸæ€�ä¿�护æƒæ™¯æ°´è´¨å‡€åŒè¾“åºç»“æžœ

2025-01-17 20:21:15,205 (taskgraph.Task) Task.add_task(706) ERROR Something went wrong when adding task create target vector (0), terminating taskgraph.
Traceback (most recent call last):
  File "taskgraph\Task.py", line 674, in add_task
  File "taskgraph\Task.py", line 1093, in _call
  File "natcap\invest\ndr\ndr.py", line 1451, in create_vector_copy
  File "src\\pygeoprocessing\\geoprocessing_core.pyx", line 77, in pygeoprocessing.geoprocessing_core.gdal_use_exceptions.wrapper
  File "src\\pygeoprocessing\\geoprocessing_core.pyx", line 78, in pygeoprocessing.geoprocessing_core.gdal_use_exceptions.wrapper
  File "pygeoprocessing\geoprocessing.py", line 2017, in get_vector_info
  File "osgeo\gdal.py", line 4669, in GetFileList
RuntimeError: PROJ: proj_identify: Cannot find proj.db
2025-01-17 20:21:15,206 (natcap.invest.utils) utils.prepare_workspace(188) ERROR Exception while executing natcap.invest.ndr.ndr
Traceback (most recent call last):
  File "natcap\invest\utils.py", line 186, in prepare_workspace
  File "invest\cli.py", line 472, in main
  File "natcap\invest\ndr\ndr.py", line 585, in execute
  File "taskgraph\Task.py", line 674, in add_task
  File "taskgraph\Task.py", line 1093, in _call
  File "natcap\invest\ndr\ndr.py", line 1451, in create_vector_copy
  File "src\\pygeoprocessing\\geoprocessing_core.pyx", line 77, in pygeoprocessing.geoprocessing_core.gdal_use_exceptions.wrapper
  File "src\\pygeoprocessing\\geoprocessing_core.pyx", line 78, in pygeoprocessing.geoprocessing_core.gdal_use_exceptions.wrapper
  File "pygeoprocessing\geoprocessing.py", line 2017, in get_vector_info
  File "osgeo\gdal.py", line 4669, in GetFileList
RuntimeError: PROJ: proj_identify: Cannot find proj.db
2025-01-17 20:21:15,210 (natcap.invest.utils) utils.prepare_workspace(191) INFO Elapsed time: 0.03s
2025-01-17 20:21:15,210 (natcap.invest.utils) utils.prepare_workspace(194) INFO Execution finished; version: 3.14.3
@davemfish davemfish added the bug Something isn't working label Jan 21, 2025
@davemfish davemfish added this to the 3.14.4 milestone Jan 21, 2025
@davemfish davemfish self-assigned this Jan 22, 2025
@davemfish davemfish added the in progress This issue is actively being worked on label Jan 22, 2025
davemfish added a commit to davemfish/invest that referenced this issue Jan 22, 2025
davemfish added a commit to davemfish/invest that referenced this issue Jan 22, 2025
davemfish added a commit to davemfish/invest that referenced this issue Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in progress This issue is actively being worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant