1

I was trying to install hdf4 and then python-hdf4. I am new to both Linux and Python. I need to read the hdf file. I though I need to install pyhdf since http://www.science-emergence.com/Articles/How-to-read-a-MODIS-HDF-file-using-python-/ has used the pyhdf module for reading pyhdf file.

At first I tried installing using command pip install pyhdf and got the error:

Could not find a version that satisfies the requirement pyhdf (from versions): No matching distribution found for pyhdf.

Then I downloaded pyhdf-0.9.0 and I tried to install it. When I try to compile while installing hdf-4.2.12, I got the error:

pyhdf/hdfext_wrap.c:3543:17: fatal error: hdf.h: No such file or directory

After searching the error using the question Install pyhdf error: hdf.h: No such file or directory I did as the file said:

  1. I downloaded pyhdf from http://support.hdfgroup.org/products/hdf4/.

  2. Then I followed the link, downloaded hdf-4.2.12, went to this directory and tried to configure it. Only then I got the following error:

    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    /home/mala/hdf-4.2.12/bin/missing: Unknown `--is-lightweight' option
    Try `/home/mala/hdf-4.2.12/bin/missing --help' for more information
    configure: WARNING: 'missing' script is too old or missing
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... no
    checking for mawk... mawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking whether to enable maintainer-specific portions of Makefiles... no
    checking shell variables initial values... done
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking if basename works... yes
    checking if xargs works... yes
    checking for config x86_64-unknown-linux-gnu... no
    checking for config x86_64-unknown-linux-gnu... no
    checking for config unknown-linux-gnu... no
    checking for config unknown-linux-gnu... no
    checking for config x86_64-linux-gnu... no
    checking for config x86_64-linux-gnu... no
    checking for config x86_64-unknown... no
    checking for config linux-gnu... found
    checking whether make sets $(MAKE)... (cached) yes
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking whether gcc understands -c and -o together... yes
    checking for style of include used by make... GNU
    checking dependency style of gcc... gcc3
    checking how to run the C preprocessor... gcc -E
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking dependency style of g++... gcc3
    checking whether we are using the GNU Fortran 77 compiler... yes
    checking whether gfortran accepts -g... yes
    checking how to get verbose linking output from gfortran... -v
    checking for Fortran 77 libraries of gfortran...  -L/usr/lib/gcc/x86_64-linux-gnu/6 -L/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/6/../../.. -lgfortran -lm -lquadmath
    checking for dummy main to link with Fortran 77 libraries... none
    checking for Fortran 77 name-mangling scheme... lower case, underscore, no extra underscore
    checking if Java JNI interface enabled... no
    checking whether ln -s works... yes
    checking for ar... ar
    checking for bison... bison -y
    checking for flex... flex
    checking for diff... diff -w
    checking for makeinfo... makeinfo
    checking for neqn... neqn
    checking for tbl... tbl
    checking how to print strings... printf
    checking for a sed that does not truncate output... /bin/sed
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for fgrep... /bin/grep -F
    checking for ld used by gcc... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
    checking the name lister (/usr/bin/nm -B) interface... BSD nm
    checking the maximum length of command line arguments... 1572864
    checking whether the shell understands some XSI constructs... yes
    checking whether the shell understands "+="... yes
    checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
    checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
    checking for /usr/bin/ld option to reload object files... -r
    checking for objdump... objdump
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... no
    checking how to associate runtime and link libraries... printf %s\n
    checking for archiver @FILE support... @
    checking for strip... strip
    checking for ranlib... ranlib
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    checking for sysroot... no
    checking for mt... mt
    checking if mt is a manifest tool... no
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... no
    checking for gcc option to produce PIC... -fPIC -DPIC
    checking if gcc PIC flag -fPIC -DPIC works... yes
    checking if gcc static flag -static works... yes
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking for shl_load... no
    checking for shl_load in -ldld... no
    checking for dlopen... no
    checking for dlopen in -ldl... yes
    checking whether a program can dlopen itself... yes
    checking whether a statically linked program can dlopen itself... no
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... no
    checking whether to build static libraries... yes
    checking how to run the C++ preprocessor... g++ -E
    checking for ld used by g++... /usr/bin/ld -m elf_x86_64
    checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
    checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking for g++ option to produce PIC... -fPIC -DPIC
    checking if g++ PIC flag -fPIC -DPIC works... yes
    checking if g++ static flag -static works... yes
    checking if g++ supports -c -o file.o... yes
    checking if g++ supports -c -o file.o... (cached) yes
    checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking dynamic linker characteristics... (cached) GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... no
    checking whether to build static libraries... yes
    checking for gfortran option to produce PIC... -fPIC
    checking if gfortran PIC flag -fPIC works... yes
    checking if gfortran static flag -static works... yes
    checking if gfortran supports -c -o file.o... yes
    checking if gfortran supports -c -o file.o... (cached) yes
    checking whether the gfortran linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking dynamic linker characteristics... (cached) GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    configure: creating ./config.lt
    config.lt: creating libtool
    checking if we should install only statically linked executables... no
    checking zlib.h usability... yes
    checking zlib.h presence... yes
    checking for zlib.h... yes
    checking for compress2 in -lz... yes
    checking for compress2... yes
    checking jpeglib.h usability... yes
    checking jpeglib.h presence... yes
    checking for jpeglib.h... yes
    checking for jpeg_start_decompress in -ljpeg... yes
    checking for szlib... suppressed
    checking for xdr library support... yes
    checking for ANSI C header files... (cached) yes
    checking whether gcc and cc understand -c and -o together... yes
    checking how to run the C++ preprocessor... g++ -E
    checking whether gfortran understands -c and -o together... yes
    checking size of int*... 8
    checking whether byte ordering is bigendian... no
    checking for build mode... production
    checking for math library support... yes
    checking for fork... yes
    checking for system... yes
    checking for vfork... yes
    checking for wait... yes
    checking if deprecated public symbols are available... yes
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating libhdf4.settings
    config.status: creating hdf/Makefile
    config.status: creating hdf/examples/Makefile
    config.status: creating hdf/fortran/Makefile
    config.status: creating hdf/fortran/examples/Makefile
    config.status: creating hdf/src/Makefile
    config.status: creating hdf/test/Makefile
    config.status: creating hdf/util/Makefile
    config.status: creating hdf/util/h4cc
    config.status: creating hdf/util/h4fc
    config.status: creating hdf/util/h4redeploy
    config.status: creating hdf/util/testutil.sh
    config.status: error: cannot find input file: man/Makefile.in'
    

I am using Ubuntu version 17.04. How can I remove this error?

  • Did you do a ./configure and/or sudo make? If yes, then your source code is incomplete. – heynnema Jun 19 '17 at 16:49
  • Could you please add a little more detail? What exactly did you do, what did you want to achieve and what happened instead? Did you encounter any warning or error messages? Please reproduce them in their entirety in your question. You can select, copy and paste terminal content and most dialogue messages in Ubuntu. (see How do I ask a good question?) – David Foerster Jun 19 '17 at 18:15
  • @heynnema. I tried to do ./configure only then I got the following error. What does source code imcomplete mean? – Mala Pokhrel Jun 20 '17 at 1:24
  • Source incomplete means that you're missing some files. The first error is /home/mala/hdf-4.2.12/bin/missing, and then there's config.status: error: cannot find input file: man/Makefile.in – heynnema Jun 20 '17 at 1:30
  • 1
    @gerrit yeah... that was almost 2 years ago, and I know better now :-) – heynnema Feb 21 at 15:26
2

You don't need to build the HDF4 library from source in Ubuntu. You can simply install it and its development files from the package libhdf4-dev.

Additionally you can also install a Python module for HDF5 from the packages python-h5py (Python 2.7) or python3-h5py (Python 3).

  • I did what you told. After installing these libraries and modules I am still not able to import pyhdf module. Am I missing something?I am sorry for the inconvenience. – Mala Pokhrel Jun 20 '17 at 8:22
  • I have edited my question . Could you please tell me what mistake I did? – Mala Pokhrel Jun 20 '17 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.