do-mpc icon indicating copy to clipboard operation
do-mpc copied to clipboard

Importlib.util causes do-mpc to crash in check for optional toolboxes

Open JoshuaAda opened this issue 1 year ago • 0 comments

Describe the bug If Do-MPC is imported before any other package that imports importlib.util, the line import do-mpc will fail to import with the following error: AttributeError: module 'importlib' has no attribute 'util' The error is caused by line 79 in _init.py: if importlib.util.find_spec("onnx"), which is the check for optional packages. Suggested fix: Add import importlib.util to line 76. If one imports importlib.util before do-mpc (see Screenshot), do-mpc gets imported correctly.

Which version of do-mpc are using and how did you obtain it?

  • Installation via pip/latest version 4.6.4

Are you running our examples or your own code? Own code

Screenshots grafik grafik

Which system are you working on?

  • Windows

Additional context Reason for the bug: https://discuss.python.org/t/python3-11-importlib-no-longer-exposes-util/25641

JoshuaAda avatar Feb 17 '24 21:02 JoshuaAda