Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h5py import error QGIS python console #828

Closed
timlarson284 opened this issue Jan 19, 2017 · 6 comments
Closed

h5py import error QGIS python console #828

timlarson284 opened this issue Jan 19, 2017 · 6 comments
Milestone

Comments

@timlarson284
Copy link

timlarson284 commented Jan 19, 2017

I have windows 64bit installation of QGIS 2.18.3. This includes a python2.7 environment as part of the package.

I used OSGeo shell to install h5py using pip install. I got the wheel with windows binaries from here http://www.lfd.uci.edu/~gohlke/pythonlibs/#h5py

h5py works fine in OSGeo shell, however when I open QGIS and go to the Python Console, which should be using the same python install and packages as the OSGeo shell, I get this error:

import h5py
Traceback (most recent call last):
File "", line 1, in
File "C:/PROGRA2/QGIS21.18/apps/qgis/./python\qgis\utils.py", line 607, in _import
mod = builtin_import(name, globals, locals, fromlist, level)
File "C:\PROGRA2\QGIS21.18\apps\Python27\lib\site-packages\h5py_init
.py", line 24, in
from . import _errors
ImportError: cannot import name _errors

Any help on why this works in OSGeo and not in QGIS Python console is appreciated.

Thanks!
Tim

@cgohlke
Copy link
Contributor

cgohlke commented Jan 20, 2017

It's probably an expected conflict of the HDF5 DLLs shipped with QGIS/OSGeo and h5py. Hence the warning at the beginning of http://www.lfd.uci.edu/~gohlke/pythonlibs/ . The solution would be to rebuild h5py against the specific version of the HDF5 library shipped with OSGeo or better against a custom build of HDF5 with different DLL names.

Btw, I get a different Traceback, which makes more sense:

>>> import h5py
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "X:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 607, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "X:\OSGeo4W\apps\Python27\lib\site-packages\h5py\__init__.py", line 34, in <module>
    from ._conv import register_converters as _register_converters
  File "X:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 607, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "h5py\h5r.pxd", line 21, in init h5py._conv (D:\Build\h5py\h5py-2.7.0rc2\h5py\_conv.c:7536)
  File "X:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 607, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "h5py\_objects.pxd", line 12, in init h5py.h5r (D:\Build\h5py\h5py-2.7.0rc2\h5py\h5r.c:3222)
  File "X:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 607, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "h5py\_objects.pyx", line 1, in init h5py._objects (D:\Build\h5py\h5py-2.7.0rc2\h5py\_objects.c:7748)
  File "X:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 607, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: DLL load failed: The specified procedure could not be found.

@jef-n
Copy link

jef-n commented Jun 14, 2017

@tacaswell
Copy link
Member

@jef-n am I correct in understanding that h5py is now shipped with QGIS? Who from QGIS should be added to the list of people we contact about new releases?

@tacaswell
Copy link
Member

Closing as fixed by down-stream packaging.

@jef-n There will be a 2.8 (and maybe a 2.7.2) in the very near future.

@krishdb38
Copy link

import h5py

Traceback (most recent call last): File "", line 1, in File "C:\Users\krish\anaconda3\envs\lims\lib\site-packages\h5py_init_.py", line 33, in from . import version File "C:\Users\krish\anaconda3\envs\lims\lib\site-packages\h5py\version.py", line 15, in from . import h5 as _h5 File "h5py\h5.pyx", line 1, in init h5py.h5 ImportError: DLL load failed while importing defs: The specified procedure could not be found.

window 10 I am facing the same kinds of problem

@jef-n
Copy link

jef-n commented Jan 14, 2022

window 10 I am facing the same kinds of problem

You are apparently not using QGIS packages (ie. OSGeo4W).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants