Problems with StatsPlots in VSCode

Hi all,

I am wondering where I should report the following problem. In the MWE below, plots will not display in VSCode. I receive the following warning:

┌ Warning: _display is not defined for this backend.
└ @ Plots ~/.julia/packages/Plots/FCM0H/src/output.jl:192

Other times in a fresh session, the plot displays, but I receive the following warning:

┌ Warning: `vendor()` is deprecated, use `BLAS.get_config()` and inspect the output instead
│   caller = npyinitialize() at numpy.jl:67
└ @ PyCall ~/.julia/packages/PyCall/3fwVL/src/numpy.jl:67

The code does work for the GR backend and also works with the PyPlot backend through the REPL, leading me to believe that the problem might be with VSCode. However, the code does work correctly with Plots. So the problem could also be with StatsPlots.

using StatsPlots, DataFrames
pyplot()

df = DataFrame(a=rand(3))
@df df plot(:a)

Version

Julia 1.7
PyPlot v2.10.0
StatsPlots v0.14.29

I am also experiencing problems with IJulia.

using StatsPlots
pyplot()
plot(rand(3))

Error

MethodError: no method matching _show(::Base64.Base64EncodePipe, ::MIME{Symbol("image/png")}, ::Plots.Plot{Plots.PyPlotBackend})
Closest candidates are:
  _show(::IO, ::MIME{Symbol("text/html")}, ::Plots.Plot) at ~/.julia/packages/Plots/FCM0H/src/output.jl:163
  _show(::IO, ::MIME{Symbol("image/png")}, ::Plots.Plot{Plots.GRBackend}) at ~/.julia/packages/Plots/FCM0H/src/backends/gr.jl:2162
  _show(::IO, ::MIME{Symbol("application/vnd.plotly.v1+json")}, ::Plots.Plot{Plots.PlotlyBackend}) at ~/.julia/packages/Plots/FCM0H/src/backends/plotly.jl:1118
  ...

Stacktrace:
  [1] show(io::Base64.Base64EncodePipe, m::MIME{Symbol("image/png")}, plt::Plots.Plot{Plots.PyPlotBackend})
    @ Plots ~/.julia/packages/Plots/FCM0H/src/output.jl:213
  [2] base64encode(::Function, ::MIME{Symbol("image/png")}, ::Vararg{Any}; context::Nothing)
    @ Base64 ~/julia-1.7.0/share/julia/stdlib/v1.7/Base64/src/encode.jl:209
  [3] base64encode(::Function, ::MIME{Symbol("image/png")}, ::Vararg{Any})
    @ Base64 ~/julia-1.7.0/share/julia/stdlib/v1.7/Base64/src/encode.jl:206
  [4] _ijulia_display_dict(plt::Plots.Plot{Plots.PyPlotBackend})
    @ Plots ~/.julia/packages/Plots/FCM0H/src/ijulia.jl:44
  [5] display_dict(plt::Plots.Plot{Plots.PyPlotBackend})
    @ Plots ~/.julia/packages/Plots/FCM0H/src/init.jl:93
  [6] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
  [7] invokelatest
    @ ./essentials.jl:714 [inlined]
  [8] execute_request(socket::ZMQ.Socket, msg::IJulia.Msg)
    @ IJulia ~/.julia/packages/IJulia/e8kqU/src/execute_request.jl:112
  [9] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [10] invokelatest
    @ ./essentials.jl:714 [inlined]
 [11] eventloop(socket::ZMQ.Socket)
    @ IJulia ~/.julia/packages/IJulia/e8kqU/src/eventloop.jl:8
 [12] (::IJulia.var"#15#18")()
    @ IJulia ./task.jl:423

I get a different error when using Plots instead of StatsPlots:

Error

UndefVarError: PyPlot not defined
Stacktrace:
 [1] top-level scope
   @ ~/.julia/packages/Plots/FCM0H/src/backends/pyplot.jl:12
Revise evaluation error at /home/dfish/.julia/packages/Plots/FCM0H/src/backends/pyplot.jl:12


Stacktrace:
  [1] methods_by_execution!(recurse::Any, methodinfo::Revise.CodeTrackingMethodInfo, docexprs::Dict{Module, Vector{Expr}}, mod::Module, ex::Expr; mode::Symbol, disablebp::Bool, always_rethrow::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Revise ~/.julia/packages/Revise/WHZdV/src/lowered.jl:204
  [2] #eval_with_signatures#92
    @ ~/.julia/packages/Revise/WHZdV/src/packagedef.jl:470 [inlined]
  [3] instantiate_sigs!(modexsigs::OrderedCollections.OrderedDict{Module, OrderedCollections.OrderedDict{Revise.RelocatableExpr, Union{Nothing, Vector{Any}}}}; mode::Symbol, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Revise ~/.julia/packages/Revise/WHZdV/src/packagedef.jl:478
  [4] #invokelatest#2
    @ ./essentials.jl:718 [inlined]
  [5] maybe_add_includes_to_pkgdata!(pkgdata::Revise.PkgData, file::String, includes::Vector{Pair{Module, String}}; eval_now::Bool)
    @ Revise ~/.julia/packages/Revise/WHZdV/src/pkgs.jl:174
  [6] eval_require_now(pkgdata::Revise.PkgData, fileidx::Int64, filekey::String, sourcefile::String, modcaller::Module, expr::Expr)
    @ Revise ~/.julia/packages/Revise/WHZdV/src/pkgs.jl:288
  [7] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
  [8] invokelatest
    @ ./essentials.jl:714 [inlined]
  [9] add_require(sourcefile::String, modcaller::Module, idmod::String, modname::String, expr::Expr)
    @ Revise ~/.julia/packages/Revise/WHZdV/src/pkgs.jl:233
 [10] withnotifications(::Any, ::Vararg{Any})
    @ Requires ~/.julia/packages/Requires/7Ncym/src/require.jl:68
 [11] (::Plots.var"#314#350")()
    @ Plots ~/.julia/packages/Requires/7Ncym/src/require.jl:96
 [12] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [13] invokelatest
    @ ./essentials.jl:714 [inlined]
 [14] foreach(f::typeof(Base.invokelatest), itr::Vector{Function})
    @ Base ./abstractarray.jl:2694
 [15] loadpkg(pkg::Base.PkgId)
    @ Requires ~/.julia/packages/Requires/7Ncym/src/require.jl:27
 [16] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [17] invokelatest
    @ ./essentials.jl:714 [inlined]
 [18] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1019
 [19] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
 [20] top-level scope
    @ ~/.julia/packages/Plots/FCM0H/src/backends.jl:676
 [21] eval
    @ ./boot.jl:373 [inlined]
 [22] _initialize_backend(#unused#::Plots.PyPlotBackend)
    @ Plots ~/.julia/packages/Plots/FCM0H/src/backends.jl:675
 [23] backend(pkg::Plots.PyPlotBackend)
    @ Plots ~/.julia/packages/Plots/FCM0H/src/backends.jl:176
 [24] #pyplot#273
    @ ~/.julia/packages/Plots/FCM0H/src/backends.jl:31 [inlined]
 [25] pyplot()
    @ Plots ~/.julia/packages/Plots/FCM0H/src/backends.jl:31
 [26] top-level scope
    @ In[2]:2
 [27] eval
    @ ./boot.jl:373 [inlined]
 [28] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1196

Version

Julia 1.6.2
IJulia v1.23.2
Plots v1.25.2
PyPlot v2.10.0
StatsPlots v0.14.29