Using unregistered packages with Pluto

How can I use an unregistered package without breaking Pluto’s package management system?

I read about the custom local registry, but I do not want to go that route.

1 Like

Pluto.activate_notebook_environment("notebook-file.jl") in a REPL will activate the environment from that notebook and then you should be able to just add stuff in the normal way with ].🎁-Package-management#advanced-edit-the-notebook-environment section at the bottom has some details.

Edit: I misread that, if you want an unregistered package you need to use a Pkg cell for that:

    import Pkg

and install the unregistered ones in there.

1 Like

But doesn’t this break Pluto’s package management system?

You can ]add unregistered packages, can’t you?

A somewhat hacky solution is to redefine a Pluto function:

function Pluto.use_plutopkg(topology::Pluto.NotebookTopology)
    !any(values(topology.nodes)) do node
        Symbol("Pkg.activate") ∈ node.references ||
        Symbol("Pkg.API.activate") ∈ node.references ||
        Symbol("quickactivate") ∈ node.references ||
        Symbol("@quickactivate") ∈ node.references

before calling Then you can use Pkg.develop and Pkg.add in notebooks without disabling the Pluto package manager.
Has been working fine for me since the introduction of this feature in Pluto.

Sorry to revive an old topic.

But is there now a more “official” solution for this?


Sorry to bring up this issue again but does this still work? I tried running it through the REPL then doing but the package manager is still not working. My code looks something like this…

Pkg.activate(; temp = true);
Pkg.add(Pkg.PackageSpec(name=“.”, url=“.”));
using ., CSV, Plots, DataFrames, Sockets