# Avoid unnecesary Statistics import

**URL:** <https://discourse.julialang.org/t/avoid-unnecesary-statistics-import/59495>\
**Category:** New to Julia\
**Tags:** packages\
**Created:** [April 17, 2021, 7:41pm UTC](https://discourse.julialang.org/t/avoid-unnecesary-statistics-import/59495 "2021-04-17T19:41:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Post date:** [April 17, 2021, 7:41pm UTC](https://discourse.julialang.org/t/avoid-unnecesary-statistics-import/59495/1 "2021-04-17T19:41:01Z")

</div>

Hello!

I am using a function from the integrated stdlib `Statistics` in my package. Do I have to check `Statistics` as a dependency explicitly? Shouldn’t it always be present because it is shipped with Julia?

The message I get everytime I precompile the package is this:

```julia
Warning: Package PPS does not have Statistics in its dependencies:
│ - If you have PPS checked out for development and have
│ added Statistics as a dependency but haven't updated your primary
│ environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with PPS
└ Loading Statistics into PPS from project dependency, future warnings for PPS are suppressed.

```

What should I do?

Thanks!

---

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [April 17, 2021, 10:25pm UTC](https://discourse.julialang.org/t/avoid-unnecesary-statistics-import/59495/2 "2021-04-17T22:25:50Z")

</div>

Yes, you have to add standard libraries as a dependency.

---

<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:** [April 17, 2021, 11:52pm UTC](https://discourse.julialang.org/t/avoid-unnecesary-statistics-import/59495/3 "2021-04-17T23:52:45Z")

</div>

It is not unnecessary if you use it in your code. Yes it is part of the standard library, but its functionality is only available after you load it via `using Statistics`. Since it is part of the standard library, it is not really contributing to dependency bloat.

---

<div class="post-metadata">

**Author:** ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Post date:** [April 18, 2021, 12:35pm UTC](https://discourse.julialang.org/t/avoid-unnecesary-statistics-import/59495/4 "2021-04-18T12:35:39Z")

</div>

Thank you both!

I was trying to avoid bloat indeed, but now it seems it is the way to go. Thanks again!

---

<div class="post-metadata">

**Author:** ![Mastomaki](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@Mastomaki](https://discourse.julialang.org/u/Mastomaki)\
**Post date:** [February 14, 2023, 11:36am UTC](https://discourse.julialang.org/t/avoid-unnecesary-statistics-import/59495/5 "2023-02-14T11:36:02Z")

</div>

I have the same issue and **already load Statistics** :

> module mypackage
> 
> using Dates  
> using Statistics
> 
> include(“source1.jl”)  
> end

In mytest.jl (located in the project folder as shown) I import mypackage:

> using Revise  
> using mypackage

mypackage/  
├─ src/  
│ ├─ mypackage.jl  
│ ├─ source1.jl  
├─ .gitignore  
├─ README.md  
├─ mytest.jl

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [February 14, 2023, 12:54pm UTC](https://discourse.julialang.org/t/avoid-unnecesary-statistics-import/59495/6 "2023-02-14T12:54:14Z")

</div>

With the project directory active, you have to `]add Statistics`
