gbouvignies / ChemEx

ChemEx is an analysis program for chemical exchange detected by NMR.
https://gbouvignies.github.io/ChemEx/
GNU General Public License v3.0
28 stars 14 forks source link

ImportError in ChemEx with Matplotlib 3.9 #233

Closed gbouvignies closed 5 months ago

gbouvignies commented 5 months ago

Description: When running ChemEx, an ImportError occurs due to the get_cmap function not being found in matplotlib.cm. This issue seems related to the use of Matplotlib 3.9.

Traceback:

Traceback (most recent call last):
  File "/Users/gbouvignies/Code/ChemEx/.venv/bin/chemex", line 5, in <module>
    from chemex.chemex import main
  File "/Users/gbouvignies/Code/ChemEx/chemex/chemex.py", line 23, in <module>
    from chemex.optimize.fitting import run_methods
  File "/Users/gbouvignies/Code/ChemEx/chemex/optimize/fitting.py", line 21, in <module>
    from chemex.optimize.gridding import run_grid
  File "/Users/gbouvignies/Code/ChemEx/chemex/optimize/gridding.py", line 12, in <module>
    from matplotlib.cm import get_cmap
ImportError: cannot import name 'get_cmap' from 'matplotlib.cm' (/Users/gbouvignies/Code/ChemEx/.venv/lib/python3.12/site-packages/matplotlib/cm.py)

Steps to Reproduce:

  1. Install Matplotlib 3.9.
  2. Run ChemEx.
  3. Observe the ImportError in the traceback.

Expected Behavior: ChemEx should import get_cmap from matplotlib.cm without errors.

Environment:

Additional Context: This issue likely stems from changes in the Matplotlib 3.9 update. Reverting to an earlier version of Matplotlib may be a temporary workaround.