Skip to content

Conversation

Kcorbyerd
Copy link
Contributor

Proposed changes

The module plotting.py contained a series of try... except statements to test for matplotlib, however in the innermost nested try... except the command matplotlib.use() was invoked with a keyword warn=False that has been deprecated since at least the release of matplotlib 3.3, and has been defaulted to False since matplotlib 3.0. Given that matplotlib <3.0 is for Python 2 mostly, and since Nexus does not support Python 2 anymore, this should be removed.

Previously, this was throwing an exception that was not caught because of the try... except statement it was contained in that caught all exceptions, in this case a TypeError, even though it should only be catching the correct exception of ValueError.

What type(s) of changes does this code introduce?

  • Bugfix

Does this introduce a breaking change?

  • No

What systems has this change been tested on?

Perlmutter with Python 3.9.18 using Matplotlib 3.8.2, and Python 3.13.2 and Matplotlib 3.10.1

Checklist

    • I have read the pull request guidance and develop docs
    • This PR is up to date with the current state of 'develop'
    • Code added or changed in the PR has been clang-formatted
    • This PR adds tests to cover any new code, or to catch a bug that is being fixed
    • Documentation has been added (if appropriate)

The module `plotting.py` contained a series of `try... except` statements to test for matplotlib, however in the innermost nested `try... except` the command `matplotlib.use()` was invoked with a keyword `warn=False` that has been deprecated since at least the release of matplotlib 3.3, and has been defaulted to `False` since matplotlib 3.0. Given that matplotlib <3.0 is for Python 2 mostly, and since Nexus does not support Python 2 anymore, this should be removed.

Previously, this was throwing an exception that was not caught because of the `try... except` statement it was contained in that caught all exceptions, in this case a `TypeError`, even though it should only be catching the correct exception of `ValueError`.
Same issue as in `plotting.py`
See QMCPACK#5622 for details
Copy link
Contributor

@prckent prckent left a comment

Choose a reason for hiding this comment

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

LGTM

Confirmed still working locally (macports installed matplot 3.10.6)

@prckent
Copy link
Contributor

prckent commented Sep 25, 2025

Test this please

@prckent
Copy link
Contributor

prckent commented Sep 29, 2025

Going ahead with merge since this is a minor local change and easy to revert in the unlikely event it is needed.

@prckent prckent merged commit 4b5eed4 into QMCPACK:develop Sep 29, 2025
41 checks passed
@Kcorbyerd Kcorbyerd deleted the plotting_bugfix branch September 29, 2025 15:52
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.

2 participants