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

sphinxext pot_directive: more robust backend switching #5039

Merged

Conversation

megies
Copy link
Contributor

@megies megies commented Sep 9, 2015

I've run into a problem with sphinxext plot_directive during a sphinx build, namely that matplotlib.use("Agg") was showing that warning and not being able to switch the backend. I didn't succeed in debugging where matplotlib was imported before it in the stack (it used to work for our documentation beforehand with the same build routine), but the proposed dynamic fallback to plt.switch_backend() worked like a charm for me.

not work by falling back to `plt.switch_backend("Agg")`
@jenshnielsen
Copy link
Member

I think the warning is due to an internal change in Matplotlib, I believe we are seeing similar warnings in the building of the examples in our own docs.

@megies
Copy link
Contributor Author

megies commented Sep 9, 2015

Well, then your docs build can only succeed because it had Agg already set in your config files, I guess? For me sphinx popped up one figure for each plot, because my default obviously is not Agg.

@WeatherGod
Copy link
Member

That shouldn't happen (the windows popping up). IIRC, everything is
configured so that AGG is forced for doc builds and it ignores the user's
default configurations. What versions of sphinx and matplotlib are you
using?

On Wed, Sep 9, 2015 at 11:39 AM, Tobias Megies notifications@github.com
wrote:

Well, then your docs build can only succeed because it had Agg already
set in your config files, I guess? For me sphinx popped up one figure for
each plot, because my default obviously is not Agg.


Reply to this email directly or view it on GitHub
#5039 (comment)
.

@megies
Copy link
Contributor Author

megies commented Sep 9, 2015

What versions of sphinx and matplotlib are you using?

anaconda                  2.1.0                np19py27_0  
anaconda-client           1.0.1                    py27_0  
basemap                   1.0.7                np19py27_0  
conda                     3.16.0                   py27_0  
conda-build               1.16.0                   py27_0  
conda-env                 2.4.2                    py27_0  
future                    0.14.3                   py27_0  
matplotlib                1.4.3                np19py27_2  
pip                       7.1.2                    py27_0  
python                    2.7.10                        0  
setuptools                18.1                     py27_0  
sphinx                    1.3.1                    py27_0  
sphinx-bootstrap-theme    0.4.5                     <pip>
sphinx-rtd-theme          0.1.7                     <pip>
sphinx_rtd_theme          0.1.7                    py27_0  

Intended to test a few more combinations of versions, but recently conda is just a real mess for me, switching versions of packages.. kind of like throwing dice, drowning in errors of mpl/qt/pyside/libpng build incompatibilities

mdboom added a commit that referenced this pull request Oct 8, 2015
…backend

sphinxext pot_directive: more robust backend switching
@mdboom mdboom merged commit 63ec8e8 into matplotlib:master Oct 8, 2015
mdboom added a commit that referenced this pull request Oct 8, 2015
…backend

sphinxext pot_directive: more robust backend switching
@tacaswell
Copy link
Member

backported as b34682c

@megies megies deleted the sphinxext_plot_directive_switch_backend branch October 8, 2015 18:55
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.

None yet

5 participants