dicompyler / dicompyler-core

A library of core radiation therapy modules for DICOM RT used by dicompyler
https://dicompyler-core.readthedocs.io
Other
147 stars 69 forks source link

Error in 0.5.7: module 'importlib' has no attribute 'util' #379

Open HelgeEgil opened 6 months ago

HelgeEgil commented 6 months ago

Thanks for this nice piece of software! I get the following error when importing dicompylercore 0.5.7 with importlib 1.0.4.

Traceback (most recent call last):
[...]
  File "....\Python39_64\lib\site-packages\dicompylercore\dvhcalc.py", line 15, in <module>
    from dicompylercore.config import skimage_available
  File "C:\....\Python39_64\lib\site-packages\dicompylercore\config.py", line 18, in <module>
    mpl_available = importlib.util.find_spec("matplotlib") is not None
AttributeError: module 'importlib' has no attribute 'util'

If I change line 16 in dicompylercore/config.py from

import importlib

to

import importlib.util

everything loads nicely.

bastula commented 6 months ago

Hello there, thanks for the kind words!

I see that you are using Python 3.9 on Windows. I haven't run into this particular issue. From what I found it might be able to be fixed by upgrading your matplotlib version. Do you mind to report back your version and see if it is 3.7.5 or below?

Please see here for more reference: https://discuss.python.org/t/python3-11-importlib-no-longer-exposes-util/25641/22