Open davidzentlermunro opened 6 years ago
I've just encountered this problem on windows 10. It seems to be independent of the python environment; I've tried the interpreter installed automatically by Conda.jl, and also manually installed via the standard anaconda installer in both python2.7 and python 3.6 flavours.
I'm not sure why this is happening yet, but I found a workaround which is to call pygui(true)
:
using PyPlot
pygui(true)
plot(randn(100))
Further version information regarding my setup, and a more complete demo:
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.2 (2017-12-13 18:08 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-w64-mingw32
julia> using PyPlot
julia> plot(randn(100))
1-element Array{PyCall.PyObject,1}:
PyObject <matplotlib.lines.Line2D object at 0x000000002EFFCEB8>
julia> # ^ But no GUI window appears at this point
julia> pygui(true)
true
julia> # Still no plot window
julia> plot(randn(100))
Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use:
QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-screen factors.
QT_SCREEN_SCALE_FACTORS to set per-screen factors.
QT_SCALE_FACTOR to set the application global scale factor.
1-element Array{PyCall.PyObject,1}:
PyObject <matplotlib.lines.Line2D object at 0x0000000030F29C88>
julia> # Plot window magically arrives now!
Ok, here's why this was happening, at least for me.
Because I'm on windows 10, I've applied the workaround from https://github.com/JuliaPy/PyPlot.jl/issues/334#issuecomment-358551237 in order to pin to the old version 2.3.1.
But in julia-0.6 PyPlot.isdisplayok()
from version 2.3.1 doesn't work due to https://github.com/JuliaPy/PyPlot.jl/issues/281.
So pygui(true)
is a workaround for this odd combination of versions, I'm not sure it will work for you @davidzentlermunro ?
Furthermore, having manually installed python 3.6 via anaconda and set ENV["PYTHON"]
to the appropriate path, I've been able to Pkg.free("PyPlot")
which upgrades PyPlot to 2.3.2
, and plotting is now working as expected.
thanks it helped me, I had the same problem
Probably it just means that PyPlot is not finding a working backend. e.g. look at PyPlot.backend
I'm using julia v0.6.0 in atom v1.22.1. I've installed pyplot after running ENV["PYTHON"]="". If I run:
using PyPlot
plot(1:5,(1:5).^2)
It returns a PyCall.PyObject and address, without displaying. Any ideas?