POSYDON-code / POSYDON

POSYDON is a next-generation single and binary-star population synthesis code incorporating full stellar structure and evolution modeling with the use of MESA.
BSD 3-Clause "New" or "Revised" License
29 stars 19 forks source link

matplotlib version issues #318

Open ezapartas opened 4 months ago

ezapartas commented 4 months ago

Using the new posydon_v2_dev_env in quest by sourcing /projects/b1119/.bash_shared_v2_dev , I got this matplotlib error:

  File "/projects/b1119/POSYDON_SHARED_v2_dev/posydon/popsyn/synthetic_population.py", line 26, in <module>
    import posydon.visualization.plot_pop as plot_pop
  File "/projects/b1119/POSYDON_SHARED_v2_dev/posydon/visualization/plot_pop.py", line 19, in <module>
    cm = plt.cm.get_cmap('tab20')
         ^^^^^^^^^^^^^^^
AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'

This function got removed in matplotlib 3.9.0, hence we either need to limit the version or rewrite our code. (@mkruckow) https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.9.0.html#removals

sgossage commented 4 months ago

Just posting this for posterity:

If we decide to stay with matplotlib version 3.9.0 with our new v2 conda environments, we will need to change the current function call to e.g.,

import matplotlib as mpl
cm = mpl.colormaps.get_cmap('tab20')

To stay with the current function call, we should downgrade matplotlib to something like version 3.7.1 (which is a version used in previous environments where this call is valid).

mkruckow commented 3 months ago

For the moment we down graded the matplotlib version in #336 . The way of #322 will be the better one after it got tested.