kdavies4 / ModelicaRes

Set up, analyze, and plot Modelica simulations in Python
http://kdavies4.github.io/ModelicaRes/
Other
51 stars 20 forks source link

Compatiblity issue with matplotlib version >=3.1.0 #42

Open zhanglexander opened 3 years ago

zhanglexander commented 3 years ago

There are multiple imports of matplolib.cbook.iterable (1, 2), however, this object is deprecated with maplotlib from version v3.1.0 (source). This has already causing import errors.

An eassiest fix would be specifying matplotlib's version <3.1.0 in setup.py. In my case v3.0.0 worked.

Enoch23 commented 3 years ago

I have the exact same problem with my conda installation. I tried your solution. But noticed that ModelicaRes is still using a newer version of matplotlib. I ran conda list and saw that matplotlib-base version 3.3.1 is installed. I removed it and re-ran the setup.py of ModelicaRes. Now I am getting ImportError: cannot import name 'rcParams' from 'matplotlib' (unknown location) Is there any other solution?

Edit: It now seems to work. I installed the oldest version 3.1.2 of matplotlib-base.

cabu3 commented 3 years ago

The downgrade to matplotlib 3.1.2 worked for me as well.

Is ModelicaRes still maintained? I feel like this is something that should be fixed sooner or later, otherwise people will not be able to use the package any more..

Sonyoyo commented 3 years ago

It looks like that this is just used to check whether an object is iterable. In this case, some alternative seems to be available as in this stackoverflow question.

For example, the following could be used:

from collections.abc import Iterable

if isinstance(e, Iterable):
    # e is iterable

It looks not so difficult to implement...but is ModelicaRes still maintained?

cabu3 commented 3 years ago

Unfortunately it doesn't look like.. The latest commit was made 5 years ago.

After a little googling I found BuildingsPy (https://github.com/lbl-srg/BuildingsPy), which can be used (among other things) to read result files from Dymola and OpenModelica. Also, it seems to be maintained. For me it has been working so far.

lukasz83krk commented 2 years ago

There are multiple imports of matplolib.cbook.iterable (1, 2), however, this object is deprecated with maplotlib from version v3.1.0 (source). This has already causing import errors.

An eassiest fix would be specifying matplotlib's version <3.1.0 in setup.py. In my case v3.0.0 worked.

use from numpy import Iterable

modify 3 py files: simres, linres, util

sede-fa commented 1 year ago

In my forked version I have implemented the above fix, you can then install it through pip with 'pip install git+https://github.com/sede-fa/ModelicaRes.git' There were a few other issues I came across and fixed, since I forked the latest commit which had some different code to the release.