You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
obnoxious double warning at each script startup #7404
For longer that I can remember, every time I start a script that imports matplotlib I get the following warnings:
/users/noel/.conda/envs/my_root/lib/python2.7/site-packages/matplotlib/backend_managers.py:62:
UserWarning: Treat the new Tool classes introduced in v1.5 as experimental for now, the API will likely
change in version 2.1 and perhaps the rcParam as well
'version 2.1 and perhaps the rcParam as well')
/users/noel/.conda/envs/my_root/lib/python2.7/site-packages/matplotlib/backend_tools.py:78:
UserWarning: Treat the new Tool classes introduced in v1.5 as experimental for now, the API will likely
change in version 2.1, and some tools might change name
'version 2.1, and some tools might change name')
These warnings are not only annoying, as I have no way to fix the code they refer to, but also lead to problems: by making the script output harder to parse, they often hide the actual output I want from the script. They are often longer than the useful script output.
I have seen suggestions to use the warning module to silence these messages, e.g.
but I don't think this is a practical solution, as 1) I would need to add these two lines every time I create a new script that uses matplotlib (which is often), and 2) I would silence at the same time all the other warnings, that could be actually useful.
matplotlib 1.5.3 Python 2.7.12 on linux installed through conda, TkAgg backend.
@vnoel You should only see these warnings if you have opted in to using the new experimental tool classes and/or tool_manager class as the warning suggests, but your comments seem to indicate that you have not done this, so I find this perplexing.
By opted in, I mean either by making use of these new experimental classes directly; or in-directly by setting the toolbar rcparam to toolmanager which one can do either as a line added to your script, or to one of your matplotlibrc files. Can you double check whether you have done any of these things. Another possibility arises from the usage of another library that sets this rcParam for you, but they should not have started using classes whilst still marked as experimental.
@OceanWolf AFAIK, I do not use these experimental classes directly. I have only very little idea of what they are.
My toolbar rcparam is set to None (in ~/.config/matplotlib/matplotlibrc), as it has been for quite some time. It is however not impossible that I might have set the toolbar to toolmanager at some point in the past, but I honestly can't remember. Could that be the cause for the warnings?
As for other libraries setting the rcParam for me, I still get the warnings by running this script:
#!/usr/bin/env python
import matplotlib.pyplot as plt
plt.figure()
so I don't think other libraries could be responsible.
Ahh, I see the problem, we assumed that the toolbar rcParam set to None should still use the toolmanager but without a toolbar. An assumption we should re-evaluate. Thank you for bringing this to our attention.
Until we get this fixed, in the next bug fix release, I have three options:
Use the current stable toolbar, either by removing the toolbar rcParam, or changing it to toolbar2, the current stable toolbar, both methods have the same effect.
Use a different backend like wxagg.
Edit the matplotlib code in matplotlib/backends/backend_tkagg.py, changing:
Activity
vnoel commentedon Nov 4, 2016
Apparently this is related to the TkAgg backend -- switching to wxagg makes the warnings disappear.
tacaswell commentedon Nov 4, 2016
attn @OceanWolf @fariza
OceanWolf commentedon Nov 4, 2016
@vnoel You should only see these warnings if you have opted in to using the new experimental tool classes and/or tool_manager class as the warning suggests, but your comments seem to indicate that you have not done this, so I find this perplexing.
By opted in, I mean either by making use of these new experimental classes directly; or in-directly by setting the
toolbarrcparam totoolmanagerwhich one can do either as a line added to your script, or to one of yourmatplotlibrcfiles. Can you double check whether you have done any of these things. Another possibility arises from the usage of another library that sets this rcParam for you, but they should not have started using classes whilst still marked as experimental.vnoel commentedon Nov 4, 2016
@OceanWolf AFAIK, I do not use these experimental classes directly. I have only very little idea of what they are.
My
toolbarrcparam is set toNone(in~/.config/matplotlib/matplotlibrc), as it has been for quite some time. It is however not impossible that I might have set thetoolbartotoolmanagerat some point in the past, but I honestly can't remember. Could that be the cause for the warnings?As for other libraries setting the rcParam for me, I still get the warnings by running this script:
so I don't think other libraries could be responsible.
OceanWolf commentedon Nov 4, 2016
Ahh, I see the problem, we assumed that the toolbar rcParam set to None should still use the toolmanager but without a toolbar. An assumption we should re-evaluate. Thank you for bringing this to our attention.
Until we get this fixed, in the next bug fix release, I have three options:
Use the current stable toolbar, either by removing the toolbar rcParam, or changing it to
toolbar2, the current stable toolbar, both methods have the same effect.Use a different backend like
wxagg.Edit the matplotlib code in
matplotlib/backends/backend_tkagg.py, changing:to
Merge pull request #7409 from OceanWolf/fix-tbar-None