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

Bugfix for a PROJ runtime error #1745

Merged

Conversation

davemfish
Copy link
Contributor

A user's PROJ_DATA env variable could trigger a RuntimeError if compatible proj.db file is not found at the location given by PROJ_DATA. In order to ensure that invest always looks for proj.db in the frozen pyinstaller environment, we can set PROJ_DATA at runtime.

We were already doing this for PROJ_LIB, but that variable has been replaced by PROJ_DATA: https://proj.org/en/stable/usage/environmentvars.html#envvar-PROJ_DATA

Fixes #1742

Checklist

  • Updated HISTORY.rst and link to any relevant issue (if these changes are user-facing)
  • Updated the user's guide (if needed)
  • Tested the Workbench UI (if relevant)

@davemfish
Copy link
Contributor Author

I'll keep this in draft until I hear back from the user that encountered this issue. They were sent a dev build. I was also able to reproduce the problem though, so I think this is a good fix.

@davemfish
Copy link
Contributor Author

I did not hear back from the forum user, but I think we can go forward with this PR anyway.

@davemfish davemfish marked this pull request as ready for review February 3, 2025 16:26
@davemfish davemfish self-assigned this Feb 3, 2025
Copy link
Contributor

@claire-simpson claire-simpson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @davemfish! Is leaving in the PROJ_LIB to ensure backwards compatibility? And is it ok that the Windows workbench test failed (assume that doesn't have to do with your changes)?

@davemfish
Copy link
Contributor Author

davemfish commented Feb 3, 2025

Thanks @davemfish! Is leaving in the PROJ_LIB to ensure backwards compatibility?

Yes, the docs state that PROJ_LIB is still supported, so if a user has it defined already I think we still want to overwrite it for the invest process. Perhaps PROJ_DATA takes precedence anyway, but seems safe to just keep them both defined.

And is it ok that the Windows workbench test failed (assume that doesn't have to do with your changes)?

Thanks @claire-simpson , I just re-ran that failed test. Hopefully it passes. It does seem to be an unrelated, intermittent failure.

@claire-simpson claire-simpson merged commit 3244770 into natcap:main Feb 3, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RuntimeError: PROJ: proj_identify: Cannot find proj.db
2 participants