My system is Windows and Python3.
I’d like to import pyhdf.SD, and I can import pyhdf
successfully.
However, when I run from pyhdf.SD import SD, SDC
, it raises
Traceback (most recent call last):
File "C:UsersusrnameAppDataLocalProgramsPythonPython39libsite-packagespyhdfhdfext.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:UsersusrnameAppDataLocalProgramsPythonPython39libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 565, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1173, in create_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
ImportError: DLL load failed while importing _hdfext: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersusrnameAppDataLocalProgramsPythonPython39librunpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:UsersusrnameAppDataLocalProgramsPythonPython39librunpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:program filesmicrosoft visual studio2022communitycommon7ideextensionsmicrosoftpythoncoredebugpy__main__.py", line 39, in <module>
cli.main()
File "c:program filesmicrosoft visual studio2022communitycommon7ideextensionsmicrosoftpythoncoredebugpy/..debugpyservercli.py", line 430, in main
run()
File "c:program filesmicrosoft visual studio2022communitycommon7ideextensionsmicrosoftpythoncoredebugpy/..debugpyservercli.py", line 284, in run_file
runpy.run_path(target, run_name="__main__")
File "c:program filesmicrosoft visual studio2022communitycommon7ideextensionsmicrosoftpythoncoredebugpy_vendoredpydevd_pydevd_bundlepydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
File "c:program filesmicrosoft visual studio2022communitycommon7ideextensionsmicrosoftpythoncoredebugpy_vendoredpydevd_pydevd_bundlepydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "c:program filesmicrosoft visual studio2022communitycommon7ideextensionsmicrosoftpythoncoredebugpy_vendoredpydevd_pydevd_bundlepydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "C:UsersusrnamesourcereposHDFHDFHDF.py", line 24, in <module>
from pyhdf.SD import SD, SDC
File "C:UsersusrnameAppDataLocalProgramsPythonPython39libsite-packagespyhdfSD.py", line 1003, in <module>
from . import hdfext as _C
File "C:UsersusrnameAppDataLocalProgramsPythonPython39libsite-packagespyhdfhdfext.py", line 17, in <module>
_hdfext = swig_import_helper()
File "C:UsersusrnameAppDataLocalProgramsPythonPython39libsite-packagespyhdfhdfext.py", line 16, in swig_import_helper
return importlib.import_module('_hdfext')
File "C:UsersusrnameAppDataLocalProgramsPythonPython39libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_hdfext'
I can find those who resolved the same issue however all those solutions are not helpful.
For example, at this forum, the “_hdftext.so” file resolved the “No _hdfext” problem, however no one except the asking question could obtain it.
Besides, I installed
numpy 1.26.4
(not latest because another module requires this)
hdf4lib 4.2.16-2
VisualStudioBuildTool2022
zlib
and They are the requirement for pyhdf which is showed on the official site but I can’t install only libjpeg because I don’t know how to install it and how it works.
How can I get the missed _hdfext file?
Any help will be greatly appreciated.
Honjo Naoki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.