Skip to content

get_cmap is a function of matplotlib.pyplot since version 3.8.0 - #1059

Merged
pariterre merged 1 commit into
pyomeca:masterfrom
siboles:master
Jul 22, 2026
Merged

get_cmap is a function of matplotlib.pyplot since version 3.8.0#1059
pariterre merged 1 commit into
pyomeca:masterfrom
siboles:master

Conversation

@siboles

@siboles siboles commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Addressing issue #1058 @pariterre

Fixed for this change and matplotlib>=3.8.0 pinned in environment.yaml.

This was a very minor fix and did not affect the environment resolution. No tests failed due to this change. Some are failing for unrelated reasons.

Expand for failed test log
FAILED tests/shard1/test__global_plots.py::test_plot_check_conditioning[PhaseDynamics.ONE_PER_NODE] - ValueError: Figure 'Check conditioning for constraints' already exists. Use plt.figure('Check conditioning for constraints') to get it or plt.close('Check conditioning for constraints') to close it. Alternatively, pass 'clear=True'...
FAILED tests/shard1/test_acados_interface.py::test_acados_no_obj[LINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_no_obj[NONLINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_one_mayer[LINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_one_mayer[NONLINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_mayer_first_node[LINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_mayer_first_node[NONLINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_several_mayer[LINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_several_mayer[NONLINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_one_lagrange[LINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_one_lagrange[NONLINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_one_lagrange_and_one_mayer[LINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_one_lagrange_and_one_mayer[NONLINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_control_lagrange_and_state_mayer[LINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_control_lagrange_and_state_mayer[NONLINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_options[LINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_options[NONLINEAR_LS] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_fail_external - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_fail_lls - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_custom_dynamics[True] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_custom_dynamics[False] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_one_parameter - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_several_parameter - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_one_end_constraints - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_constraints_all - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_constraints_end_all - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_phase_dynamics_reject - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_bounds_not_implemented[u_bounds] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_acados_interface.py::test_acados_bounds_not_implemented[x_bounds] - ModuleNotFoundError: No module named 'acados_template'
FAILED tests/shard1/test_mhe.py::test_mhe[ACADOS-PhaseDynamics.SHARED_DURING_THE_PHASE] - ModuleNotFoundError: No module named 'acados_template'

All Submissions:

  • Have you followed the guidelines in our Contributing document [docs/contribution.md]?
  • Have you checked to ensure there aren't other open [Pull Requests] for the same update/change?
  • Have you opened/linked the issue related to your pull request?
  • Have you used the tag [WIP] for on-going changes, and removed it when the pull request was ready?
  • When ready to merge, have you sent a comment pinging @pariterre in it?

New Feature Submissions:

  1. Does your submission pass the tests (if not please explain why this is intended)?
  2. Did you write a proper documentation (docstrings and ReadMe) N/A
  3. Have you linted your code locally prior to submission (using the command: black . -l120 --exclude "external/*")?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new examples for your core changes, as applicable?
  • Have you written new tests for your core changes, as applicable?

This change is Reviewable

@pariterre pariterre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@pariterre reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on siboles).

@siboles

siboles commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@pariterre as an outside contributor I don't have the option to merge. I saw the comment "(waiting on siboles)". I give my approval for the merge.

@pariterre

Copy link
Copy Markdown
Member

@siboles
Thanks for this contribution!

Can you confirm why one test fails with the following output?

 FAILED tests/shard1/test__global_plots.py::test_plot_check_conditioning[PhaseDynamics.ONE_PER_NODE] - ValueError: Figure 'Check conditioning for constraints' already exists. Use plt.figure('Check conditioning for constraints') to get it or plt.close('Check conditioning for constraints') to close it. Alternatively, pass 'clear=True' to subplots().

@siboles

siboles commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@pariterre
It appears

fig_constraints, axis_constraints = plt.subplots(1, 2, num="Check conditioning for constraints")

is the culprit. The test is parametrizing over two PhaseDynamics enums but the subplots num is hard-coded.

The quick fix is to just add clear=True to the plt.subplots() call.

@pariterre pariterre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to the current PR? I am not sure I understand why but check_conditioning was effectively changed... Will "clear=True" delete the figures or create a new one?

@pariterre made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on siboles).

@siboles

siboles commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@pariterre It is not related to this PR.

I only did a top-level trace of the error, so I'm not exactly sure how the subplots are being compiled. I believe the clear=True option will simply remove whatever was in that current subplot cell, and I suspect that was the plot from the test_plot_check_conditioning_live first run using PhaseDynamics.SHARED_DURING_THE_PHASE. That said, I haven't looked closely, so there may be a better solution.

@mickaelbegon

Copy link
Copy Markdown
Contributor

This PR is now blocking all newly opened PRs: the current CI resolves Matplotlib 3.11.1, and every test shard fails during collection with ImportError: cannot import name 'get_cmap' from 'matplotlib.cm'. PRs #1062 and #1063 both show the same repository-wide failure before their changed code is exercised. @pariterre, this PR is approved and mergeable; merging it should unblock the current CI queue.

@pariterre

Copy link
Copy Markdown
Member

This PR seems to work locally, even though CI tests fail. I will accept it so the other PR can merge it. We can deal with the failing tests later if needed

@pariterre
pariterre merged commit 10fb30c into pyomeca:master Jul 22, 2026
20 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants