# Getting a long list of warnings when "using" a package a second time

**URL:** <https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084>\
**Category:** New to Julia\
**Tags:** package, warning\
**Created:** [May 22, 2018, 8:52pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084 "2018-05-22T20:52:24Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Post date:** [May 22, 2018, 8:52pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/1 "2018-05-22T20:52:25Z")

</div>

I get a long list of warnings when I _load_ a package a second time. Is this normal? Or should I change my workflow? (I think I am doing something wrong, but I am not sure). A minimal working example is

```julia
julia> using DualNumbers
julia> workspace()
julia> using DualNumbers
WARNING: Method definition ntuple(F, Main.Base.Val{N}) in module Compat at /Users/UCIben/.julia/v0.6/Compat/src/Compat.jl:463 overwritten in module Compat at /Users/UCIben/.julia/v0.6/Compat/src/Compat.jl:463.
WARNING: Method definition spdiagm(Main.Base.Pair{A, B} where B where A...) in module Compat at /Users/UCIben/.julia/v0.6/Compat/src/Compat.jl:960 overwritten in module Compat at /Users/UCIben/.julia/v0.6/Compat/src/Compat.jl:960.
WARNING: Method definition #squeeze(Array{Any, 1}, typeof(Main.Base.squeeze), Any) in module Compat overwritten in module Compat.
WARNING: Method definition #replace(Array{Any, 1}, typeof(Main.Base.replace), AbstractString, Main.Base.Pair{A, B} where B where A) in module Compat overwritten in module Compat.
(And many more warnings...)

```

* * *

Below is my current workflow, which causes all the warnings:

1. I wrote a bunch of functions in a module (let’s call it `MyModule`) and `MyModule` happens to need dual numbers, so that it contains a line that says

```julia
using DualNumbers

```

> Is that the correct way to go? I.e., should one write modules that call another module inside of them?

1. I then usually edit some functions in `MyModule`, say the function `f(x)`, and want to run some tests on it (e.g., what is the value of `f(1)`), so I type something like this in the command-line julia:

```julia
julia> using MyModule
julia> f(1)

```

1. Then, I edit `f(x)` a bit more in `MyModule`, and test it again, by typing:

```julia
julia> workspace()
julia> using MyModule
julia> f(1)

```

which results in the long list of warnings…

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [May 22, 2018, 9:38pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/2 "2018-05-22T21:38:36Z")

</div>

In 0.7 `workspace` is removed. The warnings are also removed…

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [May 22, 2018, 9:57pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/3 "2018-05-22T21:57:05Z")

</div>

I’ve found `workspace()` to be very unreliable for this and other reasons. I much prefer using Revise.jl: [https://github.com/timholy/Revise.jl](https://github.com/timholy/Revise.jl) for live-editing modules.

---

<div class="post-metadata">

**Author:** ![Liso](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@Liso](https://discourse.julialang.org/u/Liso)\
**Post date:** [May 23, 2018, 4:16am UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/4 "2018-05-23T04:16:00Z")

</div>

> [@kristoffer.carlsson](#):
>
> In 0.7 `workspace` is removed. The warnings are also removed…

This bring next questions:

1. How long do you plan to support 0.6.x?

2. Do you have some serious support plan for Julia after 1.0?

3. What will be solution for briochemc’s problem? revise.jl will be part of std lib in 0.7?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [May 23, 2018, 5:57am UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/5 "2018-05-23T05:57:54Z")

</div>

Im not sure about 1 and don’t know what questions 2 means.

Revise is not an stdlib but is the solution to hotloading new code.

---

<div class="post-metadata">

**Author:** ![djsegal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djsegal/32/13752_2.png) [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Post date:** [May 23, 2018, 6:02am UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/6 "2018-05-23T06:02:00Z")

</div>

Sometimes, I think it’s best to not use a package a second time.

It gives you the opportunity to try other packages.

- Ken M

---

<div class="post-metadata">

**Author:** ![Liso](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@Liso](https://discourse.julialang.org/u/Liso)\
**Post date:** [May 23, 2018, 11:42am UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/7 "2018-05-23T11:42:43Z")

</div>

> [@kristoffer.carlsson](#):
>
> … don’t know what questions 2 means.

🙂 Well! It is simple - if language wants to be used seriously in industry it needs to do something like python do:

> **[PEP 537 – Python 3.7 Release Schedule | peps.python.org](https://peps.python.org/pep-0537/)**
>
> Python Enhancement Proposals (PEPs)

> ## 3.7 Lifespan
> 
> 3.7 will receive bugfix updates approximately every 3-6 months for approximately 18 months. After the release of 3.8.0 final, a final 3.7 bugfix update will be released. After that, it is expected that security updates (source only) will be released until 5 years after the release of 3.7 final, so until approximately 2023-06.

I think that something similar could help to adopt Julia in wider audience. 🙂

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [May 23, 2018, 12:33pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/8 "2018-05-23T12:33:45Z")

</div>

A release policy like that is a good idea and seems like something we indeed should strive to have.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [May 23, 2018, 1:36pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/9 "2018-05-23T13:36:13Z")

</div>

Yes, we should certainly have a policy along those lines for 1.x releases and beyond. We will not continue to support 0.6.x, however, since we want to encourage everyone to upgrade to 1.0 as strongly as possible. We will also likely switch to a timed release model since that makes sense as soon as you are no longer making breaking changes: whatever changes are made in time for a release get included in the release; whatever isn’t ready goes into a later release.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 23, 2018, 5:36pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/10 "2018-05-23T17:36:41Z")

</div>

> [@Liso](#):
>
> if language wants to be used seriously in industry

While a support policy for earlier versions is a good thing to have for software at a certain level of maturity, it is important to be mindful of the trade-offs involved. Specifically, supporting earlier versions uses work hours from skilled contributors that could be used elsewhere, possibly to improve the language.

Regarding “serious” use: I am not sure that a support policy for earlier versions was a key factor for all languages which became popular. I am under the impression that some languages became popular first, then built up a large community which had the resources for backporting and security fixes.

---

<div class="post-metadata">

**Author:** ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Post date:** [May 23, 2018, 9:36pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/11 "2018-05-23T21:36:56Z")

</div>

Thank you for all your answers! However, I am still a bit confused about the recommended way to go regarding workflow, i.e., for (i) editing functions (using `gvim` in case it is relevant) while (ii) testing code in the command-line Julia. Some things that I am still uncertain about:

- Should I be using a module at all?
- Should I use `Revise.jl`?

* * *

**[EDIT]: I should not have used `reload` with the `.jl`, so my rant was all my fault… Thanks Elrod!** 🙂  
I.e., use

```julia
julia> reload("MyModule")

```

instead of what is below **[/EDIT]**

* * *

~~Also, what about the `reload` command? It is suggested in the “workflow tips” of the v0.6 documentation [here](https://docs.julialang.org/en/release-0.6/manual/workflow-tips/), which I find **very** unclear. I don’t want to offend anyone, but it is frustrating that the recommended workflow gives an error (I am using Julia version 0.6.2 in case that’s relevant):~~

```julia
julia> reload("MyModule.jl")
ERROR: use `include` instead of `reload` to load source files

```

* * *

In case this is useful, I will describe how I have been working (mostly with MATLAB until now) and how, ideally, I would like to keep working. Please let me know if this is not the correct way:

1. Start the editor on the file that defines my functions, e.g.,

```julia
$ gvim MyModule.jl

```

1. Start the command line julia, e.g., typing

```julia
$ julia

```

1. Edit some function, e.g., `f(x)` in the editor

2. Run `f` (or something that uses `f`) in the command line julia, e.g.,

```julia
julia> f(x)

```

1. If output is not as expected, go back to 3., otherwise the output is what I want and I’m done for this task.

This workflow allowed me to quickly reach the (efficient) [3. Edit → 4. Run → 3. Edit → 4. Run → …] short loop to test and improve code… Is this workflow doable in Julia?

---

<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:** [May 23, 2018, 10:10pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/12 "2018-05-23T22:10:53Z")

</div>

> [@briochemc](#):
>
> ```julia
> julia> reload("MyModule.jl")
> ERROR: use `include` instead of `reload` to load source files
> 
> ```

Drop the “.jl”

```julia
julia> reload("Revise")

```

Yes, I would recommend using Revise. It automates the process, and only reloads the changes you make when you save files.  
I’ve always used `PkgDev.generate(....` to create modules, but I’m sure there’s a much smarter way to get them to properly appear in your path and get tracked.

---

<div class="post-metadata">

**Author:** ![ronubi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronubi/32/4085_2.png) [@ronubi](https://discourse.julialang.org/u/ronubi)\
**Post date:** [May 23, 2018, 10:21pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/13 "2018-05-23T22:21:05Z")

</div>

Not sure if this is helpful, but I’m also a recent convert from Matlab. I suggest the following:

1. Use jupyter-notebook to keep track of your work
2. Write first version of function, e.g. `myfunc()`, in a cell in the notebook
3. Test function & edit its cell until it works as expected for **some** inputs
4. Copy-paste working function to a text file “myfunc.jl” with any required `include`, `import`, or `using` statements needed by that function prepended at the top (i.e. _before_ the function definition)
5. `include("myfunc.jl")` in the notebook
6. Run test cases
7. Edit your function further and then rerun the `include` cell to update the notebook
8. If the state of the notebook gets wonky, for whatever reason:
  - Cell → AllOutput → Clear
  - Save
  - Log out and close notebook window

9. Copy output-cleared saved notebooks to newly-named files before relaunching

The only issue I’ve found with rerunning `include("myfunc.jl")` is that if you change the function arguments or return tuple, you might end up with old methods that don’t reflect the latest edited version. Relaunching the notebook solves this problem.

Good luck!

---

<div class="post-metadata">

**Author:** ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Post date:** [May 23, 2018, 10:30pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/14 "2018-05-23T22:30:28Z")

</div>

Oh thanks I completely missed this! My bad!

---

<div class="post-metadata">

**Author:** ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Post date:** [May 25, 2018, 8:44pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/15 "2018-05-25T20:44:19Z")

</div>

So I have been using `Revise` and I really like it! If I may ask: How come `Revise` is not in the recommended workflow?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [May 25, 2018, 8:54pm UTC](https://discourse.julialang.org/t/getting-a-long-list-of-warnings-when-using-a-package-a-second-time/11084/16 "2018-05-25T20:54:17Z")

</div>

On 0.7 there is

```julia
julia> workspace()
ERROR: `workspace()` is discontinued, consider Revise.jl for an alternative workflow.
Stacktrace:
 [1] error at ./error.jl:33 [inlined]
 [2] workspace() at ./deprecated.jl:1127
 [3] top-level scope

```
