Open DebChanda opened 3 years ago
One workaround to get Pluto to add PyPlot.jl to the environment is to simply import
it like this (instead of using PyPlot
as not to pollute the scope):
But the user experience with this error message is not ideal - there's no need to give up on PlutoPkg (which is what the suggested snippet would do) just to be able to use the PyPlot backend.
Like @lllusion3418 suggested, import the backend package before importing Plots, eg:
begin
import PyPlot
using Plots
end
By importing it, you tell Pluto that the package should be installed in the env, making it available to Plots.jl.
The choice to shield your notebook from knowing about a global installation of PyPlot is deliberate: we want notebooks to run independently of what packages you have installed elsewhere.
If not isolated, you might have a hidden dependency on the global PyPlot installation. Someone else opening your notebook would not be able to run it.
@lllusion3418 (and others) feel free to add a PR to "detect and rewrite" that error message. Take a look at https://github.com/fonsp/Pluto.jl/blob/main/frontend/components/ErrorMessage.js
Suggestion of @lllusion3418 works for me, you can close this issue. Or, if you want to keep it open to discuss about the error message, thats also fine. Also, you can add this suggestion in the documentation of PlutoPkg, so others can easily find it.
I am using the built-in package manager of Pluto. Is there a working example where I can see how to use different backends with Plots, currently gr and plotly are working by default. pyplot gives