-
Notifications
You must be signed in to change notification settings - Fork 7
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
GDAL 3 Environment variables not being set #7
Comments
I see that tests work now in your dummy repo. Additionally: |
@s-weigand sorry for the delay. This is still an issue, however, using setup-miniconda seems to properly set the environment variables. The easiest way to see this is by looking at the two latest Actions for that dummy repository. The test is shown as passing, but in our actual code base when we transform across coordinate systems using GDAL, this error will cause our tests to fail. Sorry for the lack of clarity with the example test. Using setup-miniconda. GDAL_DATA, PROJ_LIB ENVs are set. Using setup-conda. GDAL_DATA, PROJ_LIB are NOT set and error can be seen. The only big difference I can see from the two approaches is that setup-miniconda seems to use an environment that is not the base environment. Maybe that activation and installing helps those environment variables get and stay set from the GDAL and PROJ libraries... |
After some testing I guess I found the culpit. The way |
@s-weigand, I can confirm that adding |
so environment variables might get initialized again. See: #7
@dcdenu4 Would you be so kind to try it again with the old config? |
@s-weigand it does indeed work! Sorry for the lack of follow up. |
@dcdenu4 Just to make sure, we both talk about the same. |
Yes, we have removed the |
Awesome 😄 |
@all-contributors please add @dcdenu4 for bug |
I've put up a pull request to add @dcdenu4! 🎉 |
@all-contributors please add @dcdenu4 for bug |
I've put up a pull request to add @dcdenu4! 🎉 |
Describe the bug
Using setup-conda to install gdal 3+ on Ubuntu 18.04 and noticed GDAL_DATA and PROJ_LIB environment variables are not being set. This was noticed by getting the following error in one of our tests for a Python project when trying to use the gdal library:
ERROR 1: PROJ: proj_create_from_database: Open of /usr/share/miniconda/share/proj failed
When setting GDAL_DATA and PROJ_LIB environment variables in a yml workflow manually, calling
printenv
will show the paths to those variables, however, from the test in Python, printingos.environ
shows that these variables are still not present or set (see screeshots).To Reproduce
Steps to reproduce the behavior:
From dcdenu4/gdal3-conda-setup, .github/workflow/pythonpackage.yml :
Expected behavior
I would expect GDAL_DATA and PROJ_LIB to be set as environment variables and to be available to Python to run the GDAL Library.
Screenshots

Environment variables printed out using
printenv
after install gdal and manually setting environment variables. If not manually set, GDAL_DATA and PROJ_LIB do not appear here.A Python test using

os.environ
to show environment variables. GDAL_DATA and PROJ_LIB not present and error occurs.Desktop (please complete the following information):
Additional context
I created a dummy repo here: github.com/dcdenu4/gdal-conda-setup to help demonstrate this issue. Ultimately this problem has arisen from trying to go from GDAL 2 to GDAL 3 in a larger project, where using GDAL 3 our tests fail using this kind of workflow.
The text was updated successfully, but these errors were encountered: