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

Importing h5py in python console fails #54643

Closed
2 tasks done
Jibede opened this issue Sep 18, 2023 · 7 comments
Closed
2 tasks done

Importing h5py in python console fails #54643

Jibede opened this issue Sep 18, 2023 · 7 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Downstream Downstream packaging issues etc. Packaging Windows Related to Windows operating system

Comments

@Jibede
Copy link

Jibede commented Sep 18, 2023

What is the bug or the crash?

Console Python

Utilisez iface pour accéder à l'interface API QGIS ou tapez help(iface) pour plus d'informations

Avertissement de sécurité : la saisie de commandes provenant d'une source non fiable peut nuire à votre ordinateur

import h5py
Traceback (most recent call last):
File "C:\PROGRA1\QGIS321.0\apps\Python39\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "", line 1, in
File "C:\PROGRA1/QGIS321.0/apps/qgis/./python\qgis\utils.py", line 888, in _import
mod = builtin_import(name, globals, locals, fromlist, level)
File "C:\Users\dodeur\AppData\Roaming\Python\Python39\site-packages\h5py_init
.py", line 33, in
from . import version
File "C:\PROGRA1/QGIS321.0/apps/qgis/./python\qgis\utils.py", line 888, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "C:\Users\dodeur\AppData\Roaming\Python\Python39\site-packages\h5py\version.py", line 15, in
from . import h5 as _h5
File "C:\PROGRA1/QGIS321.0/apps/qgis/./python\qgis\utils.py", line 888, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "h5py\h5.pyx", line 1, in init h5py.h5
File "C:\PROGRA1/QGIS321.0/apps/qgis/./python\qgis\utils.py", line 888, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: DLL load failed while importing defs: La procédure spécifiée est introuvable.

Steps to reproduce the issue

open QGIS, python console :
import h5py

Versions

3.10, 3.16, 3.28, 3.32

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

I tried to reopen this issue : #29439 but did not managed.

@Jibede Jibede added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Sep 18, 2023
@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Sep 18, 2023

Hi @Jibede, thanks for reporting. It seems to me this issue is related to an additional Python package installed by you and not to QGIS itself.
I suggest you to create a ticket on https://trac.osgeo.org/osgeo4w/ or subscribe and send an e-mail message to the https://lists.osgeo.org/mailman/listinfo/osgeo4w-dev mailing list.

Please see also https://trac.osgeo.org/osgeo4w/ticket/459 and h5py/h5py#828.

@agiudiceandrea agiudiceandrea closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2023
@agiudiceandrea agiudiceandrea added Packaging Windows Related to Windows operating system Downstream Downstream packaging issues etc. labels Sep 18, 2023
@Jibede
Copy link
Author

Jibede commented Sep 19, 2023

Thx for the reply @agiudiceandrea .
The h5py import seems to work well within the osgeo4w shell. The issue lasts for years now for what I've seen. I am not skilled enough to solve it within QGIS by myslef (and I don't have permissions on my computer I guess.)
Thanks also for the ticket update on trac.osgeo.

@agiudiceandrea
Copy link
Contributor

h5py import seems to work well within the osgeo4w shell

@Jibede, how did you install QGIS and how did you install the h5py Python module? What is the h5py Python module version?

Judging form the paths shown in the error messages, it looks like the QGIS installation have mixed path to different Python packages directory in your system:
C:\Users\dodeur\AppData\Roaming\Python\Python39\
C:\PROGRA1/QGIS321.0/apps/qgis/./python\qgis\utils.py

Have you tried if the issue does occur using a new QGIS user profile?

@Jibede
Copy link
Author

Jibede commented Sep 20, 2023

@agiudiceandrea, first, I tried a pip install in the osgeo4W shell. It was installed in my user directory because I don't have permissions in the install dir in program files directory.
Importing in python in osgeo4W shell works, but I get the error in qgis python console.
Then I tried on another computer on wich I have admin permissions. I did the same, this time it was installed in the QGIS installation folder (in program files), I got the same error.

The issue occurs using a new QGIS user profile in both cases, and on a fresh install too.

@Jibede
Copy link
Author

Jibede commented Sep 20, 2023

The h5py version installed with pip is 3.9.0

@agiudiceandrea
Copy link
Contributor

@Jibede, you need to install the python3-h5py package provided by OSGeo4W using the OSGeo4W Setup program.

@Jibede
Copy link
Author

Jibede commented Sep 20, 2023

@agiudiceandrea ok I'll try this and let you know the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Downstream Downstream packaging issues etc. Packaging Windows Related to Windows operating system
Projects
None yet
Development

No branches or pull requests

2 participants