Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecation and future warnings with matplotlib #444

Open
moonshoes87 opened this issue Sep 28, 2018 · 13 comments
Open

deprecation and future warnings with matplotlib #444

moonshoes87 opened this issue Sep 28, 2018 · 13 comments
Assignees

Comments

@moonshoes87
Copy link
Member

What command was run:

pmag_gui.py -h

What happened:

/Users/nebula/Python/PmagPy/programs/pmag_gui.py:11: UserWarning: matplotlib.pyplot as already been imported, this call will have no effect.
  matplotlib.use('WXAgg')

What I expected to happen:

Backend should have been set to WXAgg, instead of being stuck as MacOSX. Problem is solved by downgrading to 2.3.3. Possibly this is a new matplotlib bug? It is of concern if new users download matplotlib 3, though.

Data file(s):

Screenshot(s):

PmagPy version:

@moonshoes87 moonshoes87 self-assigned this Oct 1, 2018
@moonshoes87
Copy link
Member Author

@moonshoes87
Copy link
Member Author

This problem is present in 3.0.1, but should be solved in 3.0.2 (see matplotlib issue referenced above).

@njarboe
Copy link
Member

njarboe commented Dec 9, 2018

I know you told me somewhere how to downgrade, but I can't find the info at the moment.
conda install matplotlib=2.3.3 does not work, as it looks like anaconda has removed it from their repos.
I upgraded all the packages and now pmag_gui give me the error above.

If people are installing anaconda for the first time then will they run into this problem?

@njarboe
Copy link
Member

njarboe commented Dec 9, 2018

Looking at the Cookbook found you mean 2.2.3 not 2.3.3 as stated above.
That works. Great. Ignore my previous comment.

@moonshoes87
Copy link
Member Author

Oh good! That's a relief.

@moonshoes87
Copy link
Member Author

It looks like this won't be resolved until 3.1.

@moonshoes87
Copy link
Member Author

Relevant issue has been closed in matplotlib, fix should be available in 3.1: matplotlib/matplotlib#13096

@moonshoes87
Copy link
Member Author

moonshoes87 commented Jun 20, 2019

All tests work except for pmagpy_tests.test_pmagplotlib.TestPlotMagMap.test_success in the Linux test environment. This test does work on my Linux VM, though. Possibly the version of wx is the problem?

Error message:

ERROR: test_success (pmagpy_tests.test_pmagplotlib.TestPlotMagMap)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/PmagPy/PmagPy/pmagpy_tests/test_pmagplotlib.py", line 22, in test_success
    1, Bs, lons, lats, 'B', date=date, contours=True, lon_0=10, proj="Mollweide")  # plot the field strength
  File "/home/travis/build/PmagPy/PmagPy/pmagpy/pmagplotlib.py", line 3529, in plot_mag_map
    fig = plt.figure(fignum)
  File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/matplotlib/pyplot.py", line 539, in figure
    **kwargs)
  File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/matplotlib/backends/backend_wx.py", line 1967, in new_figure_manager
    return super().new_figure_manager(num, *args, **kwargs)
  File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 3252, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
  File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/matplotlib/backends/backend_wx.py", line 1971, in new_figure_manager_given_figure
    frame = cls._frame_class(num, figure)
  File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/matplotlib/backends/backend_wx.py", line 1083, in __init__
    title="Figure %d" % num)
wx._core.PyNoAppError: The wx.App object must be created first!

@moonshoes87
Copy link
Member Author

Nope, having wxPython 4.0.4 instead of 4.0.6 does NOT fix the above error message :(

@moonshoes87
Copy link
Member Author

So, in general matplotlib 3.1 works just fine, for Windows, MacOS, and Linux. It fails only in one case in the test environment. I haven't yet updated the Cookbook instructions to reflect this, but PmagPy is currently compatible with either matplotlib 2.2.3 or 3.1. Yay!

@moonshoes87
Copy link
Member Author

3.1.0 works, but some issues with 3.1.2 need to be fixed:

Screen Shot 2020-01-28 at 2 39 21 PM

@moonshoes87
Copy link
Member Author

So, it looks like 3.0.3 and only 3.0.3 will work without crashing on Linux. We're going to need to address the deprecation warnings and the future warnings. 3.0.3 and 3.1.0 work on OSX.

moonshoes87 added a commit that referenced this issue Feb 4, 2020
@moonshoes87
Copy link
Member Author

Further testing -- 3.0.3 and 3.1.0 both work on linux. It's just the testing environment that is broken. So I'm going to leave this alone for now. We do still need to get those deprecation warnings and future warnings, though.

@moonshoes87 moonshoes87 changed the title problems with matplotlib 3.0.0 deprecation and future warnings with matplotlib Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants