Failing to build pyhdf

520 views Asked by At

I have been trying to install pyhdf however I get this error message which I can't seem to find the solution to.

ERROR: Command errored out with exit status 1:
   command: /project/InSAR/user1/venv/test/bin/python /project/InSAR/user1/venv/test/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpwm9u6ko8
       cwd: /tmp/pip-install-s90teiwu/pyhdf_0b2593bd32224d91a63b3304860de144
  Complete output (40 lines):
  running bdist_wheel
  running build
  running config_cc
  unifing config_cc, config, build_clib, build_ext, build commands --compiler options
  running config_fc
  unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
  running build_src
  build_src
  building extension "pyhdf._hdfext" sources
  build_src: building npy-pkg config files
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/pyhdf
  copying pyhdf/__init__.py -> build/lib.linux-x86_64-3.7/pyhdf
  copying pyhdf/six.py -> build/lib.linux-x86_64-3.7/pyhdf
  copying pyhdf/V.py -> build/lib.linux-x86_64-3.7/pyhdf
  copying pyhdf/VS.py -> build/lib.linux-x86_64-3.7/pyhdf
  copying pyhdf/test_SD.py -> build/lib.linux-x86_64-3.7/pyhdf
  copying pyhdf/error.py -> build/lib.linux-x86_64-3.7/pyhdf
  copying pyhdf/HDF.py -> build/lib.linux-x86_64-3.7/pyhdf
  copying pyhdf/SD.py -> build/lib.linux-x86_64-3.7/pyhdf
  copying pyhdf/HC.py -> build/lib.linux-x86_64-3.7/pyhdf
  copying pyhdf/hdfext.py -> build/lib.linux-x86_64-3.7/pyhdf
  running build_ext
  customize UnixCCompiler
  customize UnixCCompiler using build_ext
  building 'pyhdf._hdfext' extension
  compiling C sources
  C compiler: gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/local/hdf5/1.8.14/include -I/usr/local/gcc/4.9.3/include -I/usr/local/mpfr/3.1.4/include -I/usr/local/gmp/5.1.3/include -I/usr/local/proj/4.9.1/include -I/usr/local/geos/3.5.0/include -I/usr/local/python/3.7.2/include -I/usr/local/sqlite/3080802/include -I/usr/local/python/2.7.9/include -I/usr/local/zlib/1.2.8/include -I/usr/local/hdf5/1.8.14/include -I/usr/local/gcc/4.9.3/include -I/usr/local/mpc/1.0.3/include -I/usr/local/mpfr/3.1.4/include -I/usr/local/gmp/5.1.3/include -I/usr/local/proj/4.9.1/include -I/usr/local/geos/3.5.0/include -I/usr/local/python/3.7.2/include -I/usr/local/sqlite/3080802/include -I/usr/local/python/2.7.9/include -I/usr/local/zlib/1.2.8/include -fPIC

  creating build/temp.linux-x86_64-3.7/pyhdf
  compile options: '-I/usr/local/python/3.7.2/lib/python3.7/site-packages/numpy/core/include -I/project/InSAR/user1/venv/test/include -I/usr/local/python/3.7.2/include/python3.7m -c'
  extra options: '-DNOSZIP'
  gcc: pyhdf/hdfext_wrap.c
  pyhdf/hdfext_wrap.c:3681:17: fatal error: hdf.h: No such file or directory
   #include "hdf.h"
                   ^
  compilation terminated.
  error: Command "gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -
I/usr/local/hdf5/1.8.14/include -I/usr/local/gcc/4.9.3/include -
I/usr/local/mpfr/3.1.4/include -I/usr/local/gmp/5.1.3/include -
I/usr/local/proj/4.9.1/include -I/usr/local/geos/3.5.0/include -
I/usr/local/python/3.7.2/include -I/usr/local/sqlite/3080802/include -
I/usr/local/python/2.7.9/include -I/usr/local/zlib/1.2.8/include -
I/usr/local/hdf5/1.8.14/include -I/usr/local/gcc/4.9.3/include -
I/usr/local/mpc/1.0.3/include -I/usr/local/mpfr/3.1.4/include -
I/usr/local/gmp/5.1.3/include -I/usr/local/proj/4.9.1/include -
I/usr/local/geos/3.5.0/include -I/usr/local/python/3.7.2/include -
I/usr/local/sqlite/3080802/include -I/usr/local/python/2.7.9/include -
I/usr/local/zlib/1.2.8/include -fPIC -
I/usr/local/python/3.7.2/lib/python3.7/site-packages/numpy/core/include -
I/project/InSAR/user1/venv/test/include -
I/usr/local/python/3.7.2/include/python3.7m -c pyhdf/hdfext_wrap.c -o 
build/temp.linux-x86_64-3.7/pyhdf/hdfext_wrap.o -MMD -MF build/temp.linux-
x86_64-3.7/pyhdf/hdfext_wrap.o.d -DNOSZIP" failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pyhdf
Failed to build pyhdf
ERROR: Could not build wheels for pyhdf which use PEP 517 and cannot be installed directly

I cannot interpret what the paragraph before the dashed line means. The methods that I have tried include upgrading pip, upgrading pip setuptools wheel, installing PEP517, installing gcc. Any help would be greatly appreciated!

Edit: the command used was pip install pyhdf

Thank you!

2

There are 2 answers

1
AudioBubble On

the suggestion worked for me. I'd like to expand on it a little bit

1. Go to visual studio downloads at https://visualstudio.microsoft.com/downloads/
2. Scroll down to 'All Downloads'
3. Click the dropdown for 'Tools for Visual Studio 2019'
4. Download 'Build Tools for Visual Studio 2019'

and that should successfully update wheel and allow you to install bottleneck

Another way to resolve this is to download Windows SDK 10 (the latest version). If this alone doesn't work then download Visual Studio 2019 (again whichever is the latest version). This updates the wheel process.

this one also gonna help you link Link2

0
Peter Rochford On

A pip install of pyhdf on a Windows OS also failed for me:

pip3 install pyhdf

I successfully installed pyhdf by doing the following:

  1. Installing Anaconda 3
  2. Starting Anaconda 3 using Run as Administrator
  3. Doing an install using conda-forge as posted as an issue in the GitHub pyhdf project: conda install -c conda-forge pyhdf==0.10.5

Hope this helps others.