# Using unregistered packages with Pluto

**URL:** <https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483>\
**Category:** General Usage\
**Tags:** package, pluto\
**Created:** [December 2, 2021, 6:45pm UTC](https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483 "2021-12-02T18:45:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [December 2, 2021, 6:45pm UTC](https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483/1 "2021-12-02T18:45:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike/32/39_2.png) [@mike](https://discourse.julialang.org/u/mike)\
**Post date:** [December 2, 2021, 7:19pm UTC](https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483/2 "2021-12-02T19:19:46Z")

</div>

`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 `]`. [https://github.com/fonsp/Pluto.jl/wiki/🎁-Package-management#advanced-edit-the-notebook-environment](https://github.com/fonsp/Pluto.jl/wiki/%F0%9F%8E%81-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:

```julia
begin
    import Pkg
    Pkg.activate(mktempdir())
    Pkg.add(...)
end

```

and install the unregistered ones in there.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [December 2, 2021, 11:00pm UTC](https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483/3 "2021-12-02T23:00:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [December 2, 2021, 11:14pm UTC](https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483/4 "2021-12-02T23:14:06Z")

</div>

> [@mike](#):
>
> `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 · fonsp/Pluto.jl Wiki · GitHub](https://github.com/fonsp/Pluto.jl/wiki/%F0%9F%8E%81-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:

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

---

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [December 2, 2021, 11:31pm UTC](https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483/5 "2021-12-02T23:31:11Z")

</div>

A somewhat hacky solution is to redefine a Pluto function:

```julia
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
    end
end

```

before calling `Pluto.run()`. 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.

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [May 23, 2022, 9:11pm UTC](https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483/6 "2022-05-23T21:11:41Z")

</div>

Sorry to revive an old topic.

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

---

<div class="post-metadata">

**Author:** ![wiseac](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wiseac/32/36768_2.png) [@wiseac](https://discourse.julialang.org/u/wiseac)\
**Post date:** [May 31, 2022, 12:28am UTC](https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483/7 "2022-05-31T00:28:12Z")

</div>

Hello,

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

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

Thanks,  
W
