# Does a package extension need its deps installed directly?

**URL:** https://discourse.julialang.org/t/does-a-package-extension-need-its-deps-installed-directly/99148
**Category:** General Usage
**Tags:** package-extensions
**Created:** [May 20, 2023, 6:56am UTC](https://discourse.julialang.org/t/does-a-package-extension-need-its-deps-installed-directly/99148 "2023-05-20T06:56:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [May 20, 2023, 6:56am UTC](https://discourse.julialang.org/t/does-a-package-extension-need-its-deps-installed-directly/99148/1 "2023-05-20T06:56:23Z")

</div>

I was trying out writing a package extension to use with Makie. [GitHub - jkrumbiegel/MakiePkgExtTest](https://github.com/jkrumbiegel/MakiePkgExtTest)

In my testing, it appeared that the extension did not load when I had only CairoMakie and SomePackage installed in the main environment. The dependency of the extension is Makie, which is also always a dependency of CairoMakie (and GLMakie, etc.). But the users usually don’t install Makie directly. So I wonder if this is on purpose, or if I configured something incorrectly, etc.

---

<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: [May 20, 2023, 10:26am UTC](https://discourse.julialang.org/t/does-a-package-extension-need-its-deps-installed-directly/99148/2 "2023-05-20T10:26:56Z")

</div>

Extensions definitely load whenever their weakdep is loaded, even indirectly by some other package. That’s the only sane approach, so that extensions are basically transparent to the user.

You mention the “main environment”, maybe the issue is that your package and Makie are installed in different envs? Never tried this scenario.

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [May 20, 2023, 10:48am UTC](https://discourse.julialang.org/t/does-a-package-extension-need-its-deps-installed-directly/99148/3 "2023-05-20T10:48:55Z")

</div>

You can clone [GitHub - jkrumbiegel/MakiePkgExtTest](https://github.com/jkrumbiegel/MakiePkgExtTest) and activate the outer environment. It currently has both CairoMakie and Makie installed. In that mode, I can access the extension. If I `rm Makie`, I can’t, even though it is still installed via CairoMakie.

---

<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: [May 20, 2023, 11:07pm UTC](https://discourse.julialang.org/t/does-a-package-extension-need-its-deps-installed-directly/99148/4 "2023-05-20T23:07:31Z")

</div>

That’s what I get (after ~7 minutes of Makie+ installing…), seems like the extension does load:

```julia
(@v1.9) pkg> activate --temp

(jl_Eiu18E) pkg> add https://github.com/jkrumbiegel/MakiePkgExtTest/SomePackage CairoMakie

julia> using SomePackage

julia> methods(someplot)
# 0 methods for generic function "someplot" from SomePackage

julia> using CairoMakie

julia> methods(someplot)
# 2 methods for generic function "someplot" from SomePackage:
 [1] someplot()
     @ MakieExtension ~/.julia/packages/MakieCore/6sckc/src/recipes.jl:173
 [2] someplot(args...; attributes...)
     @ MakieExtension ~/.julia/packages/MakieCore/6sckc/src/recipes.jl:33

julia> someplot()
ERROR: Not implemented for someplot. You might want to put: `using Makie` into your code!
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] not_implemented_for(x::Function)
   @ MakieCore ~/.julia/packages/MakieCore/6sckc/src/recipes.jl:1
 [3] someplot()
   @ MakieExtension ~/.julia/packages/MakieCore/6sckc/src/recipes.jl:173
 [4] top-level scope
   @ REPL[9]:1

```

The latest error come from Makie itself, so the package extension did call into it.
