Problem with lazyImport on MacOS if module is not already imported
joezuntz opened this issue · comments
joezuntz commented
This is low priority as there is an easy workaround, but I've seen a strange issue with the lazyImport mechanism on MacOS which seems to be triggered when h5py is compiled against MPI.
When I try to import tables_io
I get this:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/jzuntz/src/tmp/conda-for-tables-io-test/lib/python3.9/site-packages/tables_io/__init__.py", line 8, in <module>
from .lazy_modules import *
File "/Users/jzuntz/src/tmp/conda-for-tables-io-test/lib/python3.9/site-packages/tables_io/lazy_modules.py", line 58, in <module>
h5py = lazyImport('h5py')
File "/Users/jzuntz/src/tmp/conda-for-tables-io-test/lib/python3.9/site-packages/tables_io/lazy_modules.py", line 49, in lazyImport
_ = dir(module)
File "/Users/jzuntz/src/tmp/conda-for-tables-io-test/lib/python3.9/importlib/util.py", line 245, in __getattribute__
self.__spec__.loader.exec_module(self)
File "/Users/jzuntz/src/tmp/conda-for-tables-io-test/lib/python3.9/site-packages/h5py/__init__.py", line 25, in <module>
from . import _errors
File "/Users/jzuntz/src/tmp/conda-for-tables-io-test/lib/python3.9/site-packages/h5py/__init__.py", line 45, in <module>
from ._conv import register_converters as _register_converters, \
File "h5py/_conv.pyx", line 1, in init h5py._conv
File "h5py/h5t.pyx", line 146, in init h5py.h5t
File "h5py/h5t.pyx", line 80, in h5py.h5t.lockid
File "h5py/h5t.pyx", line 49, in h5py.h5t.typewrap
File "h5py/defs.pyx", line 3658, in h5py.defs.H5Tget_class
RuntimeError: Unspecified error in H5Tget_class (return value <0)
If I import h5py
first and then tables_io then it works fine. This didn't happen on linux for me, just MacOS (only tested with conda and on intel). I've attached a script that recreates the issue (renamed to a txt file to enable uploading it here).
Eric Charles commented
fixed in #41