-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
PyPlot backend not working in IJulia notebook #258
Comments
I tried again, this time allowing PyPlot to install its own version of matplotlib from Conda.jl. Same problem. I'm going to try downgrading my notebook and see if that helps. |
Downgrading the notebook had no effect. It looks like it may be an issue in Plots? The first bad commit is ed1cce8, producing the following error:
Then after fd4dd13 the error becomes the one above. |
My best guess is that it has to do with your qt5 install, but I'm not On Tuesday, May 17, 2016, Scott Thomas [email protected] wrote:
|
Also please check out the dev branch of Plots. You're referencing a commit On Tuesday, May 17, 2016, Tom Breloff [email protected] wrote:
|
Yeah, it is from a while ago, isn't it? That's why I was completely baffled when Plots just stopped working yesterday. I think I updated Plots and various python packages, but if this affected anyone else then I would have expected it to be raised already. Anyway, same problem on the latest dev too! This works fine: import PyCall
PyCall.pygui(:tk) # the pyplot backend is now TkAgg
import PyPlot
x = linspace(-3,3)
y = sin(x)
PyPlot.plot(x,y) and then I can call PyPlot.savefig on it. But Plots doesn't like it:
So it seems like this call to |
A couple things:
If after all that, PyPlot works but Plots doesn't, then maybe I can be convinced that it's a Plots issue. @stevengj Any other ideas? Am I missing something? |
I'm getting the same issue (Julia 0.4.5, OSX, IJulia), though I can't tell if it was working before. There was a new PyCall.jl tagged yesterday, it's likely related. Someone in julia-users claims that it's related to IJulia FWIW, |
Yep, I've done |
OK, the first failing commit for me in PyCall is JuliaPy/PyCall.jl@453100f, which touched the flush function, so that looks promising. |
Ok yes it possible that something changed in PyPlot/PyCall recently. @stevengj this is how Plots displays to IJulia... maybe you know: const _pyplot_mimeformats = Dict(
"application/eps" => "eps",
"image/eps" => "eps",
"application/pdf" => "pdf",
"image/png" => "png",
"application/postscript" => "ps",
"image/svg+xml" => "svg"
)
for (mime, fmt) in _pyplot_mimeformats
@eval function Base.writemime(io::IO, ::MIME{symbol($mime)}, plt::AbstractPlot{PyPlotBackend})
finalizePlot(plt)
fig = getfig(plt.o)
fig.o["canvas"][:print_figure](
io,
format=$fmt,
# bbox_inches = "tight",
# figsize = map(px2inch, plt.plotargs[:size]),
facecolor = fig.o["get_facecolor"](),
edgecolor = "none",
dpi = DPI
)
end
end |
I just updated and I can reproduce your error! My update command included:
and
Hopefully someone with better PyCall knowledge can help! |
I'll open an issue at PyCall - it looks like the PyCall v.1.5.0 tag broke something. Thanks for your help diagnosing this! |
Looking at a diff between PyCall 1.4 --> 1.5, I see this (might be what you were referring to):
Could be the culprit? |
Hey, that's my commit! Oops. It's likely that the issue is in how the |
😝 At least we have the right person involved! |
And the short-term fix seems to be:
If someone resolves this, please post here! |
looks like the flush function dropped this check: if method_exists(flush, Tuple{typeof(io)})
flush(io)
end |
Yeah, it works with it. I'm preparing a PR. |
Thanks for the speedy response @cstjean !! |
It's kind of odd that |
Fixed by JuliaPy/PyCall.jl@31a80a2 in PyCall master or v1.6.1 when that gets tagged. |
change to generic dispatch
For some reason (jupyter update?) I can no longer use pyplot in the jupyter notebook:
produces
Using PyPlot directly or another backend works fine. julia 0.4.5.
The text was updated successfully, but these errors were encountered: