cwmwl
cwmwl

Reputation: 21

how to install gdal with hdf4 support macos catalina (python)

Can anyone suggest a straightforward way to install gdal with hdf4 support on macos catalina?

I have tried many ways and I am still not able to read hdf4.

  1. I installed gdal via homebrew with this instruction. Apparently that gdal has no support for hdf4.
  2. I tried installing gdal via Macports as suggested by a previous thread using sudo port install gdal +hdf4 +hdf5 +netcdf, but the installation failed with the following errors:

    Error: Failed to build gdal: command execution failed Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gis_gdal/gdal/main.log for details. Error: Follow https://guide.macports.org/#project.tickets to report a bug. Error: Processing of port gdal failed ---> Some of the ports you installed have notes: netcdf has the following notes: As of version 4.2 c++ and fortran interfaces are separate ports, netcdf-cxx and netcdf-fortran, respectively.

  3. I tried looking for solutions for the above errors and found none that matched mine. So i have given up on gdal.

  4. I moved on to install pyhdf and pymodis - both failed. Pyhdf error was: Failed to build pyhdf ERROR: Could not build wheels for pyhdf which use PEP 517 and cannot be installed directly. For pymodis, it was successful, but obviously the GDAL I installed via brew has no support for HDF4 (Error: GDAL installation has no support for HDF4, please update GDAL WxPython missing, no GUI enabled).

Any help would really be good!

Upvotes: 1

Views: 1073

Answers (1)

Rob
Rob

Reputation: 107

I struggled to find an answer to this for days. I also gave up on the gdal approach and moved on to installing pyhdf but building from source was far more complicated than it was worth. I initially avoided using anaconda because I prefer to use virtualenv for managing virtual environments, however the easiest way to get pyhdf up and running is to:

  1. install anaconda
  2. create a new virtual environment
  3. activate that new environment in a mac terminal window
  4. run conda install -c conda-forge pyhdf

You will have to reinstall all your other required packages, which might be a pain but was quicker than figuring out the build from source option. Testye

Upvotes: 0

Related Questions