Page 1 of 1

GDAL 3.0.2 error when using gdal_merge.py

PostPosted: Sun Feb 02, 2020 4:01 am
by gamecat69
Hello all,

I am using polar2grid v2.3 on centos7.

When attempting to use gdal_merge.py I got an error from pkg manager saying it could not find GDAL 3.0.2.
After a while of experimenting I managed to get sqlite3, proj6 and finally GDAL v3.0.2 installed by compiling from source, but I am still getting errors. I am running on the same server as IPOPP.

Would anyone be kind enough to share their configurations (OS and dependent package installations) please, so I can follow the same and get gdal_merge.py working.

Thanks in advance.
Nik

Re: GDAL 3.0.2 error when using gdal_merge.py

PostPosted: Mon Feb 03, 2020 1:06 pm
by davidh
Hi Nik,

Is the error message you are getting:

Code: Select all
pkg_resources.DistributionNotFound: The 'GDAL==3.0.2' distribution was not found and is required by the application


To make direct calls to "gdal_merge.py" you'll need to "source" the Polar2Grid environment by doing:

Code: Select all
source $POLAR2GRID_HOME/bin/env.sh


Where
Code: Select all
$POLAR2GRID_HOME
is the path to the Polar2Grid installation. We may need to update our documentation to address this. Thank you for bringing it up. Let me know if you have any other questions.

Dave

Re: GDAL 3.0.2 error when using gdal_merge.py

PostPosted: Mon Feb 03, 2020 3:41 pm
by gamecat69
Yes, that was exactly the error.
It now works after running the command you recommended:

Code: Select all
source $POLAR2GRID_HOME/bin/env.sh


Thank you so much!
For the sake of others I do recommend someone adds this line to the polar2grid documentation.... this one small line would have saved me days of pulling my hair out!

Re: GDAL 3.0.2 error when using gdal_merge.py

PostPosted: Tue Feb 04, 2020 12:48 pm
by kathys
Hi Nik,

Sorry that this has been so frustrating for you. The reason we do not add sourcing the environmental variable script to the Polar2Grid installation instructions is that it adds the Polar2Grid/bin directory to the beginning of your $PATH. Since P2G is self-contained, meaning it includes all of the supporting libraries and binaries that it needs to execute, these may conflict with other programs that you may be using. In the past, we have had people who ran into problems when doing this. The most effective way to use the environment variable setting script in P2G is to use it in a individual terminal or script.

Good luck! Kathy