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

Unable to import pyhdf.SD python 2.7

kharoutaj opened this issue · comments

Here is what I get when I try to import using python2.7
This machine also has python3.4 installed and the module imports fine. Any ideas?

Python 2.7.9 (default, Mar 17 2015, 22:02:16)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import numpy
import pyhdf
import pyhdf.SD
Traceback (most recent call last):
File "", line 1, in
File "pyhdf/SD.py", line 1004, in
from . import hdfext as _C
File "pyhdf/hdfext.py", line 25, in
_hdfext = swig_import_helper()
File "pyhdf/hdfext.py", line 17, in swig_import_helper
import _hdfext
ImportError: No module named _hdfext

I read through the previous issues and tried copying _hdfext.so into the site-packages directory and now I'm getting this error. It seems like there might be linkage problems? Any advice?

Python 2.7.9 (default, Mar 17 2015, 22:02:16)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import numpy
import pyhdf
import pyhdf.SD
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/pyhdf/SD.py", line 1004, in
from . import hdfext as _C
File "/usr/local/lib/python2.7/site-packages/pyhdf/hdfext.py", line 25, in
_hdfext = swig_import_helper()
File "/usr/local/lib/python2.7/site-packages/pyhdf/hdfext.py", line 21, in swig_import_helper
_mod = imp.load_module('_hdfext', fp, pathname, description)
ImportError: libsz.so.2: cannot open shared object file: No such file or directory

It looks like it's not finding the szip library. You can either install szip or disable szip support by unsetting the SZIP environment variable when you run setup.py.

It's hard to debug without looking at setup.py output.

I had szip installed in /usr/local/ and using ldd, I found that it wasn't finding the library. I had to copy the library file to /lib/ for it to work. Any idea why this would happen?

See man 8 ldconfig. My guess is either ldconfig cache is out of date or you don't have /usr/local/lib in /etc/ld.so.conf

See man 8 ldconfig. My guess is either ldconfig cache is out of date or you don't have /usr/local/lib in /etc/ld.so.conf

I'm experiencing this exact same issue, where the "szip" library is not found.

In our case, we needed to install "pyhdf" with the --no-build-isolation, and we also had to copy the _hdfext.so into the site-packages directory to fix the issue of that library not being found.

This szip library is installed in "/usr/local/pkgs/szip_2.1/lib". And copying libsz.so.2 into site-packages did not work.

Where should this szip library go, if putting it in root /lib/ is not possible (we are using GNU modules)?

My issue is at: pypa/pip#8060