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

[BUG] pythonplot backend not working: UndefVarError: pyisnone not defined #4905

Closed
BoundaryValueProblems opened this issue Mar 16, 2024 · 2 comments · Fixed by #4911
Closed

Comments

@BoundaryValueProblems
Copy link
Contributor

BoundaryValueProblems commented Mar 16, 2024

Details

The pythonplot backend was working until recently, but somehow, with Plots.jl v1.40.2, I got the following error and it's not working regardless of the platforms (MacOS, Windows). On the other hand, the gr and the plotlyjs backends are working as before. Also, the standalone PythonPlot.jl (without Plots.jl) works without any problems.

Backends

This bug occurs on a very simple plotting function.

julia> pythonplot()
Plots.PythonPlotBackend()

julia> plot(rand(10))
Error showing value of type Plots.Plot{Plots.PythonPlotBackend}:
ERROR: UndefVarError: `pyisnone` not defined
Stacktrace:
  [1] getproperty
    @ ./Base.jl:31 [inlined]
  [2] _py_bbox(obj::PythonCall.Core.Py)
    @ Plots ~/.julia/packages/Plots/a3u1v/src/backends/pythonplot.jl:219
  [3] _update_min_padding!(sp::Plots.Subplot{Plots.PythonPlotBackend})
    @ Plots ~/.julia/packages/Plots/a3u1v/src/backends/pythonplot.jl:1253
  [4] iterate
    @ ./generator.jl:47 [inlined]
  [5] _collect(c::Matrix{…}, itr::Base.Generator{…}, ::Base.EltypeUnknown, isz::Base.HasShape{…})
    @ Base ./array.jl:854
  [6] collect_similar
    @ ./array.jl:763 [inlined]
  [7] map
    @ ./abstractarray.jl:3285 [inlined]
  [8] _update_min_padding!(layout::Plots.GridLayout)
    @ Plots ~/.julia/packages/Plots/a3u1v/src/layouts.jl:277
  [9] prepare_output(plt::Plots.Plot{Plots.PythonPlotBackend})
    @ Plots ~/.julia/packages/Plots/a3u1v/src/plot.jl:244
 [10] display(::Plots.PlotsDisplay, plt::Plots.Plot{Plots.PythonPlotBackend})
    @ Plots ~/.julia/packages/Plots/a3u1v/src/output.jl:168
 [11] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:340
 [12] #invokelatest#2
    @ ./essentials.jl:892 [inlined]
 [13] invokelatest
    @ ./essentials.jl:889 [inlined]
 [14] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{…})
    @ REPL ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:315
 [15] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:284
 [16] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:569
 [17] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:282
 [18] (::REPL.var"#do_respond#80"{…})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:911
 [19] #invokelatest#2
    @ ./essentials.jl:892 [inlined]
 [20] invokelatest
    @ ./essentials.jl:889 [inlined]
 [21] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/LineEdit.jl:2656
 [22] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:1312
 [23] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:386
Some type information was truncated. Use `show(err)` to see complete types.
Backend yes no untested
gr (default) yes
pythonplot no
plotlyjs yes
pgfplotsx x
unicodeplots x
inspectdr x
gaston x

Versions

Plots.jl version: v1.40.2
Backend version (]st -m <backend(s)>): PythonPlot v1.0.3
Output of versioninfo(): Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (x86_64-apple-darwin22.4.0)
CPU: 12 × Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)
Environment:
JULIA_PKG_USE_CLI_GIT = true
LD_LIBRARY_PATH = /Users/xxx/lib:/usr/local/lib:/usr/lib:

@BeastyBlacksmith
Copy link
Member

The reason here is that PythonCall moved pyisnone into a submodule called Core. Probably should use a proper dependency on PythonCall and set compat bounds accordingly.

cc: @isentropic

@BoundaryValueProblems
Copy link
Contributor Author

Thanks a lot, @BeastyBlacksmith! When I replaced the line 219 of pythonplot.jl

PythonCall.pyisnone(obj) && return _py_bbox(nothing)

by

PythonCall.Core.pyisnone(obj) && return _py_bbox(nothing)

it started working! Could you add this for the next update of the master branch? Creating a full pull request for just this change is a bit of overkill. Thanks a lot!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants