Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Modelicares import fails in python

I want to use Modelicares to open my Dymola results in python but the import fails.

from modelicares.simres import SimRes

Gives the following error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In [2], line 1
----> 1 from modelicares.simres import SimRes

File C:\ProgramData\Miniforge3\envs\main\lib\site-packages\modelicares\__init__.py:54
     40 __version__ = '0.12.2'
     43 # Standard pylint settings for this project:
     44 # pylint: disable=I0011, C0302, C0325, R0903, R0904, R0912, R0913, R0914, R0915,
     45 # pylint: disable=I0011, W0141, W0142
   (...)
     52 # These will be available directly from modelicares; others must be loaded from
     53 # their submodules.
---> 54 from modelicares.simres import SimRes, SimResList
     55 from modelicares.linres import LinRes, LinResList
     56 from modelicares.util import (add_arrows, add_hlines, add_vlines, ArrowLine,
     57                               closeall, multiglob, figure, load_csv, save,
     58                               saveall, setup_subplots)

File C:\ProgramData\Miniforge3\envs\main\lib\site-packages\modelicares\simres.py:50
     48 from itertools import cycle
     49 from matplotlib import rcParams
---> 50 from matplotlib.cbook import iterable
     51 from matplotlib.pyplot import figlegend
     52 from pandas import DataFrame

ImportError: cannot import name 'iterable' from 'matplotlib.cbook' (C:\ProgramData\Miniforge3\envs\main\lib\site-packages\matplotlib\cbook\__init__.py)

I tried DyMat and Buildingspy but I would prefer to use Modelicares. Because Buildingspy makes use of DyMat which is quiet old and seems unmaintained.

>Solution :

I also had this issue.

I fixed this in my fork of modelicares here: https://github.com/sede-fa/ModelicaRes

I basically replaced any reference to matplotlib.cbook to numpy to get the iterable function as shown here: https://github.com/kdavies4/ModelicaRes/issues/42

You can install this via pip by doing: pip install git+https://github.com/sede-fa/ModelicaRes.git

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading