# Using a package imports some other unwanted packages, how to find out where is the unwanted package from?

**URL:** https://discourse.julialang.org/t/using-a-package-imports-some-other-unwanted-packages-how-to-find-out-where-is-the-unwanted-package-from/70041
**Category:** General Usage
**Tags:** package, module
**Created:** [October 19, 2021, 3:16pm UTC](https://discourse.julialang.org/t/using-a-package-imports-some-other-unwanted-packages-how-to-find-out-where-is-the-unwanted-package-from/70041 "2021-10-19T15:16:27Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![JianghuiDu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jianghuidu/32/8028_2.png) [@JianghuiDu](https://discourse.julialang.org/u/JianghuiDu)
#### Post date: [October 19, 2021, 3:16pm UTC](https://discourse.julialang.org/t/using-a-package-imports-some-other-unwanted-packages-how-to-find-out-where-is-the-unwanted-package-from/70041/1 "2021-10-19T15:16:27Z")

</div>

I found out some unwanted package A is imported and cause name space conflict with my own module Main. I didn’t import/using package A, so it must be loaded by other other package that I import/using. How could I find out which package loaded package A?

---

<div class="post-metadata">

### Author: ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)
#### Post date: [October 19, 2021, 3:39pm UTC](https://discourse.julialang.org/t/using-a-package-imports-some-other-unwanted-packages-how-to-find-out-where-is-the-unwanted-package-from/70041/2 "2021-10-19T15:39:21Z")

</div>

I may be wrong here, but I think `import`ing or `using` a package/module into your code should not bring any other module/package into your namespace besides the explicited one. Are you sue this is what is happening? Can you post the error message?

---

<div class="post-metadata">

### Author: ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)
#### Post date: [October 19, 2021, 3:40pm UTC](https://discourse.julialang.org/t/using-a-package-imports-some-other-unwanted-packages-how-to-find-out-where-is-the-unwanted-package-from/70041/3 "2021-10-19T15:40:27Z")

</div>

You can always go through your packages manually like this

```julia
julia> using B

julia> A
ERROR: UndefVarError: A not defined

julia> using C

julia> A
A

```

where we see that (in this example) `B` was not exporting `A` but `C` was.

---

<div class="post-metadata">

### Author: ![JianghuiDu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jianghuidu/32/8028_2.png) [@JianghuiDu](https://discourse.julialang.org/u/JianghuiDu)
#### Post date: [October 19, 2021, 3:44pm UTC](https://discourse.julialang.org/t/using-a-package-imports-some-other-unwanted-packages-how-to-find-out-where-is-the-unwanted-package-from/70041/4 "2021-10-19T15:44:19Z")

</div>

This is a bit tedious when you import many packages. Is there a shortcut?

---

<div class="post-metadata">

### Author: ![JianghuiDu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jianghuidu/32/8028_2.png) [@JianghuiDu](https://discourse.julialang.org/u/JianghuiDu)
#### Post date: [October 19, 2021, 3:48pm UTC](https://discourse.julialang.org/t/using-a-package-imports-some-other-unwanted-packages-how-to-find-out-where-is-the-unwanted-package-from/70041/5 "2021-10-19T15:48:57Z")

</div>

I found the culprit.

Somehow using Plots also loads`alpha` from package `ColorTypes`

```julia
using Plots
julia> ColorTypes.alpha
alpha (generic function with 5 methods)

```

This conflict with my `const alpha =1`  
What I don’t understand is that in `Plots` I don’t see its dependence on `ColorTypes`

So is it true that import/using one package won’t load other packages?

---

<div class="post-metadata">

### Author: ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)
#### Post date: [October 19, 2021, 3:57pm UTC](https://discourse.julialang.org/t/using-a-package-imports-some-other-unwanted-packages-how-to-find-out-where-is-the-unwanted-package-from/70041/7 "2021-10-19T15:57:51Z")

</div>

> [@JianghuiDu](#):
>
> So is it true that import/using one package won’t load other packages?

I believe not, one package can export whatever they want and they may export things from other packages.

> [@JianghuiDu](#):
>
> What I don’t understand is that in `Plots` I don’t see its dependence on `ColorTypes`

No direct dependance, but

```julia
(@v1.6) pkg> activate --temp
  Activating new environment at `/tmp/jl_bxylqu/Project.toml`

(jl_bxylqu) pkg> st
      Status `/tmp/jl_bxylqu/Project.toml` (empty project)

(jl_bxylqu) pkg> add Plots
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
   Installed Latexify ─────── v0.15.7
   Installed StatsBase ────── v0.33.12
   Installed ChainRulesCore ─ v1.10.0
    Updating `/tmp/jl_bxylqu/Project.toml`
  [91a5bcdd] + Plots v1.22.6
    Updating `/tmp/jl_bxylqu/Manifest.toml`
  [79e6a3ab] + Adapt v3.3.1
  [d360d2e6] + ChainRulesCore v1.10.0
  [35d6a980] + ColorSchemes v3.15.0
  [3da002f7] + ColorTypes v0.11.0
...

```

so it is somewhere in the dependancy tree.
