gimli-org / gimli

Geophysical Inversion and Modeling Library :earth_africa:
https://www.pygimli.org
Other
383 stars 137 forks source link

Matplotlib version >3.8.4 causes failure to load module #749

Closed Coastal0 closed 2 months ago

Coastal0 commented 4 months ago

Using the latest version of matplotlib results in ImportError. Specifying previous stable release 3.8.4 results in example code working. Testing code with _plot_02_ert_fielddata.ipynb on a fresh conda environment.

P.S. I had to grab the slagdump.ohm dataset from a BERT install - I couldn't see it anywhere on pyGIMLi...!

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[1], line 1
----> 1 import pygimli as pg
      2 from pygimli.physics import ert

File [~\AppData\Local\anaconda3\envs\pg\Lib\site-packages\pygimli\__init__.py:50](http://localhost:8889/~/AppData/Local/anaconda3/envs/pg/Lib/site-packages/pygimli/__init__.py#line=49)
     47 from .testing import test  #, setTestingMode, testingMode
     49 from .math import matrix  # alias all from .core.matrix.* to pg.matrix.*
---> 50 from .core.load import (load, optImport, getCachePath,
     51                         getExampleFile, getExampleData)
     54 def checkAndFixLocaleDecimal_point(verbose=False):  # verbose overwritten
     55     """
     56     """

File [~\AppData\Local\anaconda3\envs\pg\Lib\site-packages\pygimli\core\load.py:17](http://localhost:8889/~/AppData/Local/anaconda3/envs/pg/Lib/site-packages/pygimli/core/load.py#line=16)
     15 from pygimli.utils import readGPX
     16 # from pygimli.utils import cache  # not used yet
---> 17 from pygimli.physics.traveltime import load as loadTT
     20 __gimliExampleDataRepo__ = 'gimli-org/example-data/'
     21 __gimliExampleDataBase__ = 'example-data'

File [~\AppData\Local\anaconda3\envs\pg\Lib\site-packages\pygimli\physics\__init__.py:11](http://localhost:8889/~/AppData/Local/anaconda3/envs/pg/Lib/site-packages/pygimli/physics/__init__.py#line=10)
      9 from .ert import ERTManager, ERTModelling
     10 from .ves import VESManager
---> 11 from .em import VMDTimeDomainModelling
     12 from .traveltime import TravelTimeManager
     14 Refraction = TravelTimeManager  # Backward compatibility to pg 1.0

File [~\AppData\Local\anaconda3\envs\pg\Lib\site-packages\pygimli\physics\em\__init__.py:6](http://localhost:8889/~/AppData/Local/anaconda3/envs/pg/Lib/site-packages/pygimli/physics/em/__init__.py#line=5)
      2 """Frequency-domain (FD) or time-domain (TD) semi-analytical 1D solutions"""
      4 from .vmd import VMDTimeDomainModelling
----> 6 from .fdem import FDEM
      7 from .tdem import TDEM, rhoafromB, rhoafromU
      8 from .hemmodelling import HEMmodelling

File [~\AppData\Local\anaconda3\envs\pg\Lib\site-packages\pygimli\physics\em\fdem.py:12](http://localhost:8889/~/AppData/Local/anaconda3/envs/pg/Lib/site-packages/pygimli/physics/em/fdem.py#line=11)
     10 import pygimli as pg
     11 from pygimli.viewer.mpl import show1dmodel, drawModel1D
---> 12 from .hemmodelling import HEMmodelling
     14 freqMaxMin10 = 2**np.arange(10) * 110.
     15 freqMaxMin8 = 2**np.arange(8) * 110.

File [~\AppData\Local\anaconda3\envs\pg\Lib\site-packages\pygimli\physics\em\hemmodelling.py:8](http://localhost:8889/~/AppData/Local/anaconda3/envs/pg/Lib/site-packages/pygimli/physics/em/hemmodelling.py#line=7)
      5 import numpy as np
      7 from matplotlib.colors import LinearSegmentedColormap
----> 8 from matplotlib.cm import register_cmap
     10 import pygimli as pg
     11 from pygimli.frameworks import Block1DModelling

ImportError: cannot import name 'register_cmap' from 'matplotlib.cm' ([C:\Users\Alexc\AppData\Local\anaconda3\envs\pg\Lib\site-packages\matplotlib\cm.py](file:///C:/Users/Alexc/AppData/Local/anaconda3/envs/pg/Lib/site-packages/matplotlib/cm.py))
halbmy commented 4 months ago

This bug was already fixed two months ago by 3520105. We just need to create a new version.

Coastal0 commented 3 months ago

Thanks Thomas - any ETA on the new version?

halbmy commented 3 months ago

We have to wait for Florian to be back, which should be next week. Put it on top of the list.

halbmy commented 2 months ago

v1.5.2 was released two weeks ago. Can you please check whether this solves the issue?

Coastal0 commented 2 months ago

Looks like this has resolved the issue; thanks guys!