[Qgis-developer] Importing a Python module for reading HDF5

Radosław Pasiok rpasiok at gmail.com
Tue Oct 6 11:30:51 PDT 2015


Hello Devs!

I would like to kindly ask for help in importing any Python module for
reading HDF5 files on 64bit QGIS in Windows (OSGeo4W distribution).
I tried to use *h5py* and *pytables* binaries from [1]. There is no problem
with importing the modules in a Python session run from OSGeo Shell:

Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import h5py
>>> import tables
>>>

But in the QGIS Python console:

>>> import h5py
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~2\apps\Python27\lib\site-packages\h5py\__init__.py", line
23, in <module>
    from . import _conv
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, 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.5.x\h5py\_conv.c:6975)
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, 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.5.x\h5py\h5r.c:2885)
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, 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.5.x\h5py\_objects.c:6993)
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: DLL load failed: Nie mo¿na odnaleŸæ okreœlonej procedury.
>>> import tables
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~2\apps\Python27\lib\site-packages\tables\__init__.py",
line 85, in <module>
    from tables.utilsextension import (
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: DLL load failed: Nie mo¿na odnaleŸæ okreœlonej procedury.
>>> import tables
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~2\apps\Python27\lib\site-packages\tables\__init__.py",
line 85, in <module>
    from tables.utilsextension import (
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: DLL load failed: Nie mo¿na odnaleŸæ okreœlonej procedury.
>>> import h5py
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~2\apps\Python27\lib\site-packages\h5py\__init__.py", line
13, in <module>
    from . import _errors
ImportError: cannot import name _errors
>>> import h5py
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:/OSGEO4~2/apps/qgis-ltr/./python\qgis\utils.py", line 478, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~2\apps\Python27\lib\site-packages\h5py\__init__.py", line
13, in <module>
    from . import _errors
ImportError: cannot import name _errors

Please, note the errors differences between first and second try of import.
What is the difference between Python session run from the shell and QGIS
console that could cause the problem?

This problem doesn't exist in the QGIS 32-bit.

Thank you very much for any help!

Radek



[1] http://www.lfd.uci.edu/~gohlke/pythonlibs/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20151006/6bee01b8/attachment-0001.html>


More information about the Qgis-developer mailing list