fhs / pyhdf

Python wrapper around the NCSA HDF version 4 library

Home Page:https://pypi.org/project/pyhdf/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can not install in Fedora27&28

zh-py opened this issue · comments

commented

I have installed hdf-devel.x86_64 in my system.
Tried pip3 and python3 setup.py install both ways, got the same result:

pip3 install --user python-hdf4
Collecting python-hdf4
  Using cached https://files.pythonhosted.org/packages/02/07/15a5e258e48a7d252c0efee187ddc4322a8bc8969c65b400aeda1fda2843/python-hdf4-0.9.1.tar.gz
Building wheels for collected packages: python-hdf4
  Running setup.py bdist_wheel for python-hdf4 ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rlcv6i46/python-hdf4/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp43jl60htpip-wheel- --python-tag cp36:
  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.6
  creating build/lib.linux-x86_64-3.6/pyhdf
  copying pyhdf/HDF.py -> build/lib.linux-x86_64-3.6/pyhdf
  copying pyhdf/error.py -> build/lib.linux-x86_64-3.6/pyhdf
  copying pyhdf/V.py -> build/lib.linux-x86_64-3.6/pyhdf
  copying pyhdf/hdfext.py -> build/lib.linux-x86_64-3.6/pyhdf
  copying pyhdf/HC.py -> build/lib.linux-x86_64-3.6/pyhdf
  copying pyhdf/SD.py -> build/lib.linux-x86_64-3.6/pyhdf
  copying pyhdf/test_SD.py -> build/lib.linux-x86_64-3.6/pyhdf
  copying pyhdf/six.py -> build/lib.linux-x86_64-3.6/pyhdf
  copying pyhdf/VS.py -> build/lib.linux-x86_64-3.6/pyhdf
  copying pyhdf/__init__.py -> build/lib.linux-x86_64-3.6/pyhdf
  running build_ext
  customize UnixCCompiler
  customize UnixCCompiler using build_ext
  building 'pyhdf._hdfext' extension
  compiling C sources
  C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC
  
  creating build/temp.linux-x86_64-3.6/pyhdf
  compile options: '-I/usr/include/hdf/ -I/home/meteo/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c'
  extra options: '-DNOSZIP'
  gcc: pyhdf/hdfext_wrap.c
  In file included from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1816,
                   from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                   from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                   from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/oldnumeric.h:1,
                   from pyhdf/hdfext_wrap.c:3680:
  /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   #warning "Using deprecated NumPy API, disable it by " \
    ^~~~~~~
  pyhdf/hdfext_wrap.c: In function ‘HDFtoNumericType’:
  pyhdf/hdfext_wrap.c:3720:9: warning: ‘NPY_CHAR’ is deprecated: Use NPY_STRING [-Wdeprecated-declarations]
           case DFNT_CHAR8  : num = PyArray_CHAR; break;
           ^~~~
  In file included from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                   from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                   from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/oldnumeric.h:1,
                   from pyhdf/hdfext_wrap.c:3680:
  /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:84:21: note: declared here
                       NPY_CHAR NPY_ATTR_DEPRECATE("Use NPY_STRING"),
                       ^~~~~~~~
  pyhdf/hdfext_wrap.c: In function ‘_SDreaddata_0’:
  pyhdf/hdfext_wrap.c:3835:9: warning: ‘NPY_CHAR’ is deprecated: Use NPY_STRING [-Wdeprecated-declarations]
           case PyArray_CHAR:
           ^~~~
  In file included from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                   from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                   from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/oldnumeric.h:1,
                   from pyhdf/hdfext_wrap.c:3680:
  /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:84:21: note: declared here
                       NPY_CHAR NPY_ATTR_DEPRECATE("Use NPY_STRING"),
                       ^~~~~~~~
  pyhdf/hdfext_wrap.c: In function ‘_SDgetcompress’:
  pyhdf/hdfext_wrap.c:3947:36: warning: passing argument 2 of ‘SDgetcompress’ from incompatible pointer type [-Wincompatible-pointer-types]
       status = SDgetcompress(sds_id, comp_type, &c_info);
                                      ^~~~~~~~~
  In file included from pyhdf/hdfext_wrap.c:3544:
  /usr/include/hdf/mfhdf.h:186:30: note: expected ‘comp_coder_t *’ {aka ‘enum <anonymous> *’} but argument is of type ‘int32 *’ {aka ‘int *’}
       (int32 id, comp_coder_t* type, comp_info *c_info);
                  ~~~~~~~~~~~~~~^~~~
  pyhdf/hdfext_wrap.c: In function ‘_wrap_SDcreate’:
  pyhdf/hdfext_wrap.c:5849:62: warning: passing argument 5 of ‘SDcreate’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     result = (int32)SDcreate(arg1,(char const *)arg2,arg3,arg4,(int const *)arg5);
                                                                ^~~~~~~~~~~~~~~~~
  In file included from pyhdf/hdfext_wrap.c:3544:
  /usr/include/hdf/mfhdf.h:104:64: note: expected ‘int32 *’ {aka ‘int *’} but argument is of type ‘const int *’
       (int32 fid, const char *name, int32 nt, int32 rank, int32 *dimsizes);
                                                           ~~~~~~~^~~~~~~~
  pyhdf/hdfext_wrap.c: In function ‘_wrap_SDsetdimscale’:
  pyhdf/hdfext_wrap.c:6393:48: warning: passing argument 4 of ‘SDsetdimscale’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     result = (int32)SDsetdimscale(arg1,arg2,arg3,(void const *)arg4);
                                                  ^~~~~~~~~~~~~~~~~~
  In file included from pyhdf/hdfext_wrap.c:3544:
  /usr/include/hdf/mfhdf.h:159:46: note: expected ‘void *’ but argument is of type ‘const void *’
       (int32 id, int32 count, int32 nt, void * data);
                                         ~~~~~~~^~~~
  pyhdf/hdfext_wrap.c: In function ‘_wrap_SDsetfillvalue’:
  pyhdf/hdfext_wrap.c:7069:39: warning: passing argument 2 of ‘SDsetfillvalue’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     result = (int32)SDsetfillvalue(arg1,(void const *)arg2);
                                         ^~~~~~~~~~~~~~~~~~
  In file included from pyhdf/hdfext_wrap.c:3544:
  /usr/include/hdf/mfhdf.h:140:26: note: expected ‘void *’ but argument is of type ‘const void *’
       (int32 sdsid, void * val);
                     ~~~~~~~^~~
  pyhdf/hdfext_wrap.c: In function ‘_wrap_SDsetrange’:
  pyhdf/hdfext_wrap.c:7105:35: warning: passing argument 2 of ‘SDsetrange’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     result = (int32)SDsetrange(arg1,(void const *)arg2,(void const *)arg3);
                                     ^~~~~~~~~~~~~~~~~~
  In file included from pyhdf/hdfext_wrap.c:3544:
  /usr/include/hdf/mfhdf.h:116:26: note: expected ‘void *’ but argument is of type ‘const void *’
       (int32 sdsid, void * pmax, void * pmin);
                     ~~~~~~~^~~~
  pyhdf/hdfext_wrap.c:7105:54: warning: passing argument 3 of ‘SDsetrange’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     result = (int32)SDsetrange(arg1,(void const *)arg2,(void const *)arg3);
                                                        ^~~~~~~~~~~~~~~~~~
  In file included from pyhdf/hdfext_wrap.c:3544:
  /usr/include/hdf/mfhdf.h:116:39: note: expected ‘void *’ but argument is of type ‘const void *’
       (int32 sdsid, void * pmax, void * pmin);
                                  ~~~~~~~^~~~
  pyhdf/hdfext_wrap.c: In function ‘_wrap_VSsizeof’:
  pyhdf/hdfext_wrap.c:8020:32: warning: passing argument 2 of ‘VSsizeof’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     result = (intn)VSsizeof(arg1,(char const *)arg2);
                                  ^~~~~~~~~~~~~~~~~~
  In file included from /usr/include/hdf/hdf.h:154,
                   from pyhdf/hdfext_wrap.c:3543:
  /usr/include/hdf/hproto.h:1644:38: note: expected ‘char *’ but argument is of type ‘const char *’
                   (int32 vkey, char  * fields);
                                ~~~~~~~~^~~~~~
  pyhdf/hdfext_wrap.c: In function ‘_wrap_VSfexist’:
  pyhdf/hdfext_wrap.c:8468:32: warning: passing argument 2 of ‘VSfexist’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     result = (intn)VSfexist(arg1,(char const *)arg2);
                                  ^~~~~~~~~~~~~~~~~~
  In file included from /usr/include/hdf/hdf.h:154,
                   from pyhdf/hdfext_wrap.c:3543:
  /usr/include/hdf/hproto.h:1641:38: note: expected ‘char *’ but argument is of type ‘const char *’
                   (int32 vkey, char  * fields);
                                ~~~~~~~~^~~~~~
  pyhdf/hdfext_wrap.c: In function ‘_SDreaddata_0’:
  pyhdf/hdfext_wrap.c:3854:12: warning: ‘o’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       return o;
              ^
  pyhdf/hdfext_wrap.c: In function ‘_wrap__SDgetcompress’:
  pyhdf/hdfext_wrap.c:729:27: warning: ‘temp4’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   #define PyInt_FromLong(x) PyLong_FromLong(x)
                             ^~~~~~~~~~~~~~~
  pyhdf/hdfext_wrap.c:7128:9: note: ‘temp4’ was declared here
     int32 temp4 ;
           ^~~~~
  pyhdf/hdfext_wrap.c:729:27: warning: ‘temp5’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   #define PyInt_FromLong(x) PyLong_FromLong(x)
                             ^~~~~~~~~~~~~~~
  pyhdf/hdfext_wrap.c:7130:9: note: ‘temp5’ was declared here
     int32 temp5 ;
           ^~~~~
  pyhdf/hdfext_wrap.c:729:27: warning: ‘temp6’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   #define PyInt_FromLong(x) PyLong_FromLong(x)
                             ^~~~~~~~~~~~~~~
  pyhdf/hdfext_wrap.c:7132:9: note: ‘temp6’ was declared here
     int32 temp6 ;
           ^~~~~
  pyhdf/hdfext_wrap.c:729:27: warning: ‘temp7’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   #define PyInt_FromLong(x) PyLong_FromLong(x)
                             ^~~~~~~~~~~~~~~
  pyhdf/hdfext_wrap.c:7134:9: note: ‘temp7’ was declared here
     int32 temp7 ;
           ^~~~~
  pyhdf/hdfext_wrap.c:729:27: warning: ‘temp3’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   #define PyInt_FromLong(x) PyLong_FromLong(x)
                             ^~~~~~~~~~~~~~~
  pyhdf/hdfext_wrap.c:7126:9: note: ‘temp3’ was declared here
     int32 temp3 ;
           ^~~~~
  gcc -pthread -shared -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none build/temp.linux-x86_64-3.6/pyhdf/hdfext_wrap.o -L/usr/lib64 -lmfhdf -ldf -ljpeg -lz -lpython3.6m -o build/lib.linux-x86_64-3.6/pyhdf/_hdfext.cpython-36m-x86_64-linux-gnu.so
  /usr/bin/ld: cannot find -lmfhdf
  /usr/bin/ld: cannot find -ldf
  collect2: error: ld returned 1 exit status
  /usr/bin/ld: cannot find -lmfhdf
  /usr/bin/ld: cannot find -ldf
  collect2: error: ld returned 1 exit status
  error: Command "gcc -pthread -shared -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none build/temp.linux-x86_64-3.6/pyhdf/hdfext_wrap.o -L/usr/lib64 -lmfhdf -ldf -ljpeg -lz -lpython3.6m -o build/lib.linux-x86_64-3.6/pyhdf/_hdfext.cpython-36m-x86_64-linux-gnu.so " failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for python-hdf4
  Running setup.py clean for python-hdf4
Failed to build python-hdf4
Installing collected packages: python-hdf4
  Running setup.py install for python-hdf4 ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rlcv6i46/python-hdf4/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-pp37r3i0-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    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.6
    creating build/lib.linux-x86_64-3.6/pyhdf
    copying pyhdf/HDF.py -> build/lib.linux-x86_64-3.6/pyhdf
    copying pyhdf/error.py -> build/lib.linux-x86_64-3.6/pyhdf
    copying pyhdf/V.py -> build/lib.linux-x86_64-3.6/pyhdf
    copying pyhdf/hdfext.py -> build/lib.linux-x86_64-3.6/pyhdf
    copying pyhdf/HC.py -> build/lib.linux-x86_64-3.6/pyhdf
    copying pyhdf/SD.py -> build/lib.linux-x86_64-3.6/pyhdf
    copying pyhdf/test_SD.py -> build/lib.linux-x86_64-3.6/pyhdf
    copying pyhdf/six.py -> build/lib.linux-x86_64-3.6/pyhdf
    copying pyhdf/VS.py -> build/lib.linux-x86_64-3.6/pyhdf
    copying pyhdf/__init__.py -> build/lib.linux-x86_64-3.6/pyhdf
    running build_ext
    customize UnixCCompiler
    customize UnixCCompiler using build_ext
    building 'pyhdf._hdfext' extension
    compiling C sources
    C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC
    
    creating build/temp.linux-x86_64-3.6/pyhdf
    compile options: '-I/usr/include/hdf/ -I/home/meteo/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c'
    extra options: '-DNOSZIP'
    gcc: pyhdf/hdfext_wrap.c
    In file included from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1816,
                     from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                     from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/oldnumeric.h:1,
                     from pyhdf/hdfext_wrap.c:3680:
    /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     #warning "Using deprecated NumPy API, disable it by " \
      ^~~~~~~
    pyhdf/hdfext_wrap.c: In function ‘HDFtoNumericType’:
    pyhdf/hdfext_wrap.c:3720:9: warning: ‘NPY_CHAR’ is deprecated: Use NPY_STRING [-Wdeprecated-declarations]
             case DFNT_CHAR8  : num = PyArray_CHAR; break;
             ^~~~
    In file included from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                     from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/oldnumeric.h:1,
                     from pyhdf/hdfext_wrap.c:3680:
    /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:84:21: note: declared here
                         NPY_CHAR NPY_ATTR_DEPRECATE("Use NPY_STRING"),
                         ^~~~~~~~
    pyhdf/hdfext_wrap.c: In function ‘_SDreaddata_0’:
    pyhdf/hdfext_wrap.c:3835:9: warning: ‘NPY_CHAR’ is deprecated: Use NPY_STRING [-Wdeprecated-declarations]
             case PyArray_CHAR:
             ^~~~
    In file included from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                     from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/oldnumeric.h:1,
                     from pyhdf/hdfext_wrap.c:3680:
    /home/meteo/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:84:21: note: declared here
                         NPY_CHAR NPY_ATTR_DEPRECATE("Use NPY_STRING"),
                         ^~~~~~~~
    pyhdf/hdfext_wrap.c: In function ‘_SDgetcompress’:
    pyhdf/hdfext_wrap.c:3947:36: warning: passing argument 2 of ‘SDgetcompress’ from incompatible pointer type [-Wincompatible-pointer-types]
         status = SDgetcompress(sds_id, comp_type, &c_info);
                                        ^~~~~~~~~
    In file included from pyhdf/hdfext_wrap.c:3544:
    /usr/include/hdf/mfhdf.h:186:30: note: expected ‘comp_coder_t *’ {aka ‘enum <anonymous> *’} but argument is of type ‘int32 *’ {aka ‘int *’}
         (int32 id, comp_coder_t* type, comp_info *c_info);
                    ~~~~~~~~~~~~~~^~~~
    pyhdf/hdfext_wrap.c: In function ‘_wrap_SDcreate’:
    pyhdf/hdfext_wrap.c:5849:62: warning: passing argument 5 of ‘SDcreate’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       result = (int32)SDcreate(arg1,(char const *)arg2,arg3,arg4,(int const *)arg5);
                                                                  ^~~~~~~~~~~~~~~~~
    In file included from pyhdf/hdfext_wrap.c:3544:
    /usr/include/hdf/mfhdf.h:104:64: note: expected ‘int32 *’ {aka ‘int *’} but argument is of type ‘const int *’
         (int32 fid, const char *name, int32 nt, int32 rank, int32 *dimsizes);
                                                             ~~~~~~~^~~~~~~~
    pyhdf/hdfext_wrap.c: In function ‘_wrap_SDsetdimscale’:
    pyhdf/hdfext_wrap.c:6393:48: warning: passing argument 4 of ‘SDsetdimscale’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       result = (int32)SDsetdimscale(arg1,arg2,arg3,(void const *)arg4);
                                                    ^~~~~~~~~~~~~~~~~~
    In file included from pyhdf/hdfext_wrap.c:3544:
    /usr/include/hdf/mfhdf.h:159:46: note: expected ‘void *’ but argument is of type ‘const void *’
         (int32 id, int32 count, int32 nt, void * data);
                                           ~~~~~~~^~~~
    pyhdf/hdfext_wrap.c: In function ‘_wrap_SDsetfillvalue’:
    pyhdf/hdfext_wrap.c:7069:39: warning: passing argument 2 of ‘SDsetfillvalue’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       result = (int32)SDsetfillvalue(arg1,(void const *)arg2);
                                           ^~~~~~~~~~~~~~~~~~
    In file included from pyhdf/hdfext_wrap.c:3544:
    /usr/include/hdf/mfhdf.h:140:26: note: expected ‘void *’ but argument is of type ‘const void *’
         (int32 sdsid, void * val);
                       ~~~~~~~^~~
    pyhdf/hdfext_wrap.c: In function ‘_wrap_SDsetrange’:
    pyhdf/hdfext_wrap.c:7105:35: warning: passing argument 2 of ‘SDsetrange’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       result = (int32)SDsetrange(arg1,(void const *)arg2,(void const *)arg3);
                                       ^~~~~~~~~~~~~~~~~~
    In file included from pyhdf/hdfext_wrap.c:3544:
    /usr/include/hdf/mfhdf.h:116:26: note: expected ‘void *’ but argument is of type ‘const void *’
         (int32 sdsid, void * pmax, void * pmin);
                       ~~~~~~~^~~~
    pyhdf/hdfext_wrap.c:7105:54: warning: passing argument 3 of ‘SDsetrange’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       result = (int32)SDsetrange(arg1,(void const *)arg2,(void const *)arg3);
                                                          ^~~~~~~~~~~~~~~~~~
    In file included from pyhdf/hdfext_wrap.c:3544:
    /usr/include/hdf/mfhdf.h:116:39: note: expected ‘void *’ but argument is of type ‘const void *’
         (int32 sdsid, void * pmax, void * pmin);
                                    ~~~~~~~^~~~
    pyhdf/hdfext_wrap.c: In function ‘_wrap_VSsizeof’:
    pyhdf/hdfext_wrap.c:8020:32: warning: passing argument 2 of ‘VSsizeof’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       result = (intn)VSsizeof(arg1,(char const *)arg2);
                                    ^~~~~~~~~~~~~~~~~~
    In file included from /usr/include/hdf/hdf.h:154,
                     from pyhdf/hdfext_wrap.c:3543:
    /usr/include/hdf/hproto.h:1644:38: note: expected ‘char *’ but argument is of type ‘const char *’
                     (int32 vkey, char  * fields);
                                  ~~~~~~~~^~~~~~
    pyhdf/hdfext_wrap.c: In function ‘_wrap_VSfexist’:
    pyhdf/hdfext_wrap.c:8468:32: warning: passing argument 2 of ‘VSfexist’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       result = (intn)VSfexist(arg1,(char const *)arg2);
                                    ^~~~~~~~~~~~~~~~~~
    In file included from /usr/include/hdf/hdf.h:154,
                     from pyhdf/hdfext_wrap.c:3543:
    /usr/include/hdf/hproto.h:1641:38: note: expected ‘char *’ but argument is of type ‘const char *’
                     (int32 vkey, char  * fields);
                                  ~~~~~~~~^~~~~~
    pyhdf/hdfext_wrap.c: In function ‘_SDreaddata_0’:
    pyhdf/hdfext_wrap.c:3854:12: warning: ‘o’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         return o;
                ^
    pyhdf/hdfext_wrap.c: In function ‘_wrap__SDgetcompress’:
    pyhdf/hdfext_wrap.c:729:27: warning: ‘temp4’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     #define PyInt_FromLong(x) PyLong_FromLong(x)
                               ^~~~~~~~~~~~~~~
    pyhdf/hdfext_wrap.c:7128:9: note: ‘temp4’ was declared here
       int32 temp4 ;
             ^~~~~
    pyhdf/hdfext_wrap.c:729:27: warning: ‘temp5’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     #define PyInt_FromLong(x) PyLong_FromLong(x)
                               ^~~~~~~~~~~~~~~
    pyhdf/hdfext_wrap.c:7130:9: note: ‘temp5’ was declared here
       int32 temp5 ;
             ^~~~~
    pyhdf/hdfext_wrap.c:729:27: warning: ‘temp6’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     #define PyInt_FromLong(x) PyLong_FromLong(x)
                               ^~~~~~~~~~~~~~~
    pyhdf/hdfext_wrap.c:7132:9: note: ‘temp6’ was declared here
       int32 temp6 ;
             ^~~~~
    pyhdf/hdfext_wrap.c:729:27: warning: ‘temp7’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     #define PyInt_FromLong(x) PyLong_FromLong(x)
                               ^~~~~~~~~~~~~~~
    pyhdf/hdfext_wrap.c:7134:9: note: ‘temp7’ was declared here
       int32 temp7 ;
             ^~~~~
    pyhdf/hdfext_wrap.c:729:27: warning: ‘temp3’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     #define PyInt_FromLong(x) PyLong_FromLong(x)
                               ^~~~~~~~~~~~~~~
    pyhdf/hdfext_wrap.c:7126:9: note: ‘temp3’ was declared here
       int32 temp3 ;
             ^~~~~
    gcc -pthread -shared -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none build/temp.linux-x86_64-3.6/pyhdf/hdfext_wrap.o -L/usr/lib64 -lmfhdf -ldf -ljpeg -lz -lpython3.6m -o build/lib.linux-x86_64-3.6/pyhdf/_hdfext.cpython-36m-x86_64-linux-gnu.so
    /usr/bin/ld: cannot find -lmfhdf
    /usr/bin/ld: cannot find -ldf
    collect2: error: ld returned 1 exit status
    /usr/bin/ld: cannot find -lmfhdf
    /usr/bin/ld: cannot find -ldf
    collect2: error: ld returned 1 exit status
    error: Command "gcc -pthread -shared -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none build/temp.linux-x86_64-3.6/pyhdf/hdfext_wrap.o -L/usr/lib64 -lmfhdf -ldf -ljpeg -lz -lpython3.6m -o build/lib.linux-x86_64-3.6/pyhdf/_hdfext.cpython-36m-x86_64-linux-gnu.so " failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rlcv6i46/python-hdf4/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-pp37r3i0-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-rlcv6i46/python-hdf4/

Could anyone help me? Thanks!

It can't find the HDF4 library .so files. Set $LIBRARY_DIRS to where you have libmfhdf.so and libdf.so. See Installation instruction.

Closing. Reopen if it doesn't work out.

commented
commented
commented

Check the output of ldd /home/zheng/.local/lib/python3.6/site-packages/pyhdf/_hdfext*.so
You should see something like this:

	libmfhdf.so.0 => /usr/lib/libmfhdf.so.0 (0x00007fad49e45000)
	libdf.so.0 => /usr/lib/libdf.so.0 (0x00007fad49b93000)
commented
commented
commented
commented

Szip (libsz) is an optional dependency. It shouldn't be looking for it unless you have $SZIP environment variable set.

commented

Unset $SZIP. It doesn't look at its value, just if it is set.

commented