Order matters when importing PyPlot and Plots, IJulia 1.18.1

Dear all,

I want to use PyPlot and Plots in parallel in order to enable interactivity for certain plots in jupyterlab (Julia 1.1.1; IJulia 1.18.1). It seems that

import Plots, PyPlot
pygui(true)

leads to an error:

ArgumentError: invalid gui none

Stacktrace:
 [1] pygui(::Symbol) at /Users/mariusgorner/.julia/packages/PyCall/ttONZ/src/gui.jl:59
 [2] pygui_start(::Symbol, ::Float64) at /Users/mariusgorner/.julia/packages/PyCall/ttONZ/src/gui.jl:222 (repeats 2 times)
 [3] pygui(::Bool) at /Users/mariusgorner/.julia/packages/PyPlot/cdCMF/src/init.jl:211
 [4] top-level scope at In[1]:2

while

import PyPlot, Plots
pygui(true)

just works fine. This does not happen in the REPL.
Is there another way to use the pygui directly from Plots frontend?

I think in general this approach is not advisable because both packages export functions with the same name and you are not guaranteed that everything will work. I ended up using only PyPlot.jl when I need some low level access to PyPlot’s capabilities.

1 Like

Thanks. Yes, maybe that’s the best solution for now.