PyPlot.jl
PyPlot.jl copied to clipboard
I get this error in Julia: ArgumentError: hasproperty of NULL PyObject What is it and how to resolve it?
ArgumentError: hasproperty of NULL PyObject
Stacktrace: [1] pyhasproperty(::PyCall.PyObject, ::String) at C:\Users\Home.julia\packages\PyCall\BcTLp\src\PyCall.jl:359 [2] hasproperty at C:\Users\Home.julia\packages\PyCall\BcTLp\src\PyCall.jl:365 [inlined] [3] ioff(; kws::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\Home.julia\packages\PyPlot\XHEG0\src\PyPlot.jl:174 [4] ioff() at C:\Users\Home.julia\packages\PyPlot\XHEG0\src\PyPlot.jl:174 [5] top-level scope at C:\Users\Home.julia\packages\Plots\vsE7b\src\backends.jl:510 [6] eval at .\boot.jl:331 [inlined] [7] _initialize_backend(::Plots.PyPlotBackend) at C:\Users\Home.julia\packages\Plots\vsE7b\src\backends.jl:504 [8] backend at C:\Users\Home.julia\packages\Plots\vsE7b\src\backends.jl:174 [inlined] [9] pyplot(; kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\Home.julia\packages\Plots\vsE7b\src\backends.jl:31 [10] pyplot() at C:\Users\Home.julia\packages\Plots\vsE7b\src\backends.jl:31 [11] top-level scope at In[10]:2 [12] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091
Having the same problem recently, though I'm running manjaro
but I narrowed it to
julia> using PyPlot
┌ Warning: No working GUI backend found for matplotlib
└ @ PyPlot ~/.julia/packages/PyPlot/XHEG0/src/init.jl:165
ERROR: InitError: PyError (PyImport_ImportModule) <class 'ValueError'>
ValueError('call stack is not deep enough')
File "/usr/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 107, in _import
importing_module = sys._getframe(1).f_globals.get("__name__", "__main__")
Native python works of course, but also:
julia> plt = pyimport("matplotlib.pyplot")
PyObject <module 'matplotlib.pyplot' from '/home/zhanibek/.local/lib/python3.8/site-packages/matplotlib/pyplot.py'>
julia> plt.plot(1)
1-element Array{PyObject,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f268cba9370>
julia> plt.show()
works too. I tried using sytem python and rebuilding both packages to no avail. This happened after a recent system update
i also got his bug, seems pyplot is very hard to use. We cannot even find a solution for this bug.
i also got his bug, seems pyplot is very hard to use. We cannot even find a solution for this bug.
I am experiencing the same problem...
Same here
Hi, I also ran into this issue. In my case i called
scatter(...)
scatter!(...)
inside a loop.
adding the overwrite_figure=true argument to scatter(...) resolved it for me.
Same problem, did you solve it?
It generally means that PyPlot wasn't able to initialize properly — there was probably an error earlier that you ignored?