Hi Guillaume,
thanks for your email. I working with pycharm in python. This conflict shows in the root cause a way to dask. The initial error appears in usage of napari. I did an upgrade of dask and the same error message appeared.
Now I have the same problem with interpreter ome-types. There was following error message;
C:\Users\Born\venv\Scripts\python.exe “C:\Users\Born\PycharmProjects\python bio process Pims_DA_NA\TR1 F PY bioformats nd2reader1.py”
Traceback (most recent call last):
File “C:\Users\Born\PycharmProjects\python bio process Pims_DA_NA\TR1 F PY bioformats nd2reader1.py”, line 4, in
import ome_types
File “C:\Users\Born\venv\Lib\site-packages\ome_types_init_.py”, line 13, in
from ome_types import model
File “C:\Users\Born\venv\Lib\site-packages\ome_types\model_init_.py”, line 9, in
from ome_types.autogenerated.ome_2016_06 import * # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Born\venv\Lib\site-packages\ome_types_autogenerated\ome_2016_06_init.py", line 1, in
from ome_types._autogenerated.ome_2016_06.affine_transform import (
File “C:\Users\Born\venv\Lib\site-packages\ome_types_autogenerated\ome_2016_06\affine_transform.py”, line 1, in
from ome_types._mixins.base_type import OMEType
File “C:\Users\Born\venv\Lib\site-packages\ome_types_mixins_base_type.py”, line 25, in
from ome_types.units import add_quantity_properties
File “C:\Users\Born\venv\Lib\site-packages\ome_types\units.py”, line 6, in
import pint
File "C:\Users\Born\venv\Lib\site-packages\pint_init.py", line 28, in
from .formatting import formatter, register_unit_format
File “C:\Users\Born\venv\Lib\site-packages\pint\formatting.py”, line 20, in
from .babel_names import _babel_lengths, babel_units
File “C:\Users\Born\venv\Lib\site-packages\pint\babel_names.py”, line 11, in
from .compat import HAS_BABEL
File “C:\Users\Born\venv\Lib\site-packages\pint\compat.py”, line 206, in
from dask import array as dask_array
File "C:\Users\Born\venv\Lib\site-packages\dask\array_init.py", line 4, in
from dask.array import backends, fft, lib, linalg, ma, overlap, random
File “C:\Users\Born\venv\Lib\site-packages\dask\array\backends.py”, line 8, in
from dask.array.core import Array
File “C:\Users\Born\venv\Lib\site-packages\dask\array\core.py”, line 32, in
from tlz.curried import pluck
File “”, line 1178, in _find_and_load
File “”, line 1149, in _find_and_load_unlocked
File “”, line 690, in load_unlocked
File “C:\Users\Born\venv\Lib\site-packages\tlz_build_tlz.py”, line 82, in exec_module
submodule = import_module(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Born\AppData\Local\Programs\Python\Python311\Lib\importlib_init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 1206, in _gcd_import
File “”, line 1178, in _find_and_load
File “”, line 1147, in _find_and_load_unlocked
AttributeError: ‘TlzSpec’ object has no attribute ‘_uninitialized_submodules’
Process finished with exit code 1
I raised the question about this error message to gemini. There answer showed also a root cause to dask:
The error message you provided indicates a complex dependency issue within your Python environment. It seems there’s a conflict between the ome-types
library and the dask
library. Here’s a breakdown of the error and some potential solutions:
Error Analysis:
- The error originates from the
dask.array.core
module trying to import tlz
.
- Inside
tlz\_build_tlz.py
, there’s an AttributeError
: 'TlzSpec' object has no attribute '_uninitialized_submodules'
. This suggests an incompatibility between tlz
and other libraries in your environment.
Potential Causes:
- Conflicting
tlz
versions: The ome-types
library or other dependencies might require a specific version of tlz
that’s incompatible with the version used by dask
.
Solutions:
-
Upgrade dask
(if possible):
-
Try upgrading dask
to a newer version using pip
:
Bash
pip install --upgrade dask
Verwende den Code mit Vorsicht.
-
Newer dask
versions might have better compatibility with newer tlz
versions used by ome-types
.
-
Check ome-types
documentation:
- Refer to the
ome-types
documentation or release notes to see if there are any known compatibility issues with specific dask
versions. They might suggest compatible versions or alternative solutions.
-
Create a clean virtual environment:
- Consider creating a fresh virtual environment and installing only the required libraries (
ome-types
, bioformats
, etc.) to avoid conflicts from other packages.
-
Advanced: Manual dependency management:
- This is a more complex solution, but you can try manually installing specific versions of
tlz
and dask
that are known to be compatible. This requires knowledge of dependency management tools like pip
or conda
.
Additional Tips:
- After making any changes to your environment (upgrades, new installations), activate the virtual environment and try running your script again.
- If you’re still stuck, consider searching online forums or communities related to
ome-types
, dask
, or scientific Python for similar issues and solutions.
By following these steps and investigating the specific libraries involved, you should be able to resolve the dependency conflict and run your Python script successfully.