# How to suppress/hide all the warnings in IJulia or Julia language?

**URL:** <https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 28, 2017, 11:01am UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110 "2017-07-28T11:01:56Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhangliye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhangliye/32/3208_2.png) [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Post date:** [July 28, 2017, 11:01am UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/1 "2017-07-28T11:01:56Z")

</div>

There are a lot of warnings which are always of no need to be fixed, while including code files. This makes the IJulia page messy. How to hide these warnings in Julia language or IJulia? Can anyone help? Thanks!

 ![捕获](https://global.discourse-cdn.com/julialang/original/3X/4/e/4ebc4133ea757bfb9743aef76e5abf26d2a660ae.png)

There is an example of the ugly notebook page caused by the warnings as follows.  
[https://github.com/dmoliveira/my-juliabox/blob/master/Data%20Analysis%20-%20Julia%20%2B%20Gadfly%20-%20Scatter-Matrix%20Example.ipynb](https://github.com/dmoliveira/my-juliabox/blob/master/Data%20Analysis%20-%20Julia%20%2B%20Gadfly%20-%20Scatter-Matrix%20Example.ipynb)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 28, 2017, 4:41pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/2 "2017-07-28T16:41:09Z")

</div>

Install an IJulia kernel with deprecation warnings turned off, [from the IJulia README](https://github.com/JuliaLang/IJulia.jl/blob/master/README.md#installing-additional-julia-kernels):

```julia
using IJulia
IJulia.installkernel("Julia nodeps", "--depwarn=no")

```

---

<div class="post-metadata">

**Author:** ![zhangliye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhangliye/32/3208_2.png) [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Post date:** [July 28, 2017, 5:20pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/3 "2017-07-28T17:20:21Z")

</div>

Thanks for your swift reply!

---

<div class="post-metadata">

**Author:** ![zhangliye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhangliye/32/3208_2.png) [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Post date:** [July 28, 2017, 5:28pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/4 "2017-07-28T17:28:34Z")

</div>

Thanks for your swift reply! I have tried but got an error of no definition of installkernel() function.  
I use Julia 0.5.2, IJulia 1.5.1, on windows 7.

I also tested addkernel() function. Also got the error of “no function defined”.

Thanks!

![捕获](https://global.discourse-cdn.com/julialang/original/3X/f/3/f3aaf3960b9c55a87caaa01b6a3b944204683d74.png)

---

<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:** [July 28, 2017, 6:20pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/5 "2017-07-28T18:20:20Z")

</div>

These are not deprecation warnings. Ref [https://github.com/JuliaLang/julia/pull/23002](https://github.com/JuliaLang/julia/pull/23002)

---

<div class="post-metadata">

**Author:** ![zhangliye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhangliye/32/3208_2.png) [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Post date:** [July 28, 2017, 6:59pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/6 "2017-07-28T18:59:18Z")

</div>

@kristoffer.carlsson Totally agree with you. It is the common workflow to redefine the function during developing and testing. I write the functions using Juno, and calling them in IJulia to show the results. It works well for me. The only pain thing is the ugly IJulia notebook caused by the large amount of warnings.

I try to fix it with the following code suggested by @stevengj. However, the code can not run correctly.

```julia
using IJulia
IJulia.installkernel("Julia nodeps", "--depwarn=no")

```

I use Julia 0.5.2, IJulia1.5 on windows 7.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 28, 2017, 7:19pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/7 "2017-07-28T19:19:54Z")

</div>

> [@zhangliye](#):
>
> got an error of no definition of installkernel()

I haven’t tagged a new release of IJulia with this function yet. Do `Pkg.checkout("IJulia")` to get this feature.

---

<div class="post-metadata">

**Author:** ![zhangliye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhangliye/32/3208_2.png) [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Post date:** [July 28, 2017, 7:52pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/8 "2017-07-28T19:52:15Z")

</div>

@stevengj Thanks for your reply. I am able to run “installkernel()” and also able to change to the new kernel. However, the warnings are still there. I found that this function created a new kernel.json adding a new parameter of “–depwarn=no”.  
In fact, before posting this question I have already tried to add this to kernel.json manually. But, ~~it does not work~~ it only suppresses the deprecation warnings.

Thank you so much for your help. By the way, the package of PyCall.jl and PyPlot.jl are extremely helpful. Without these two packages, maybe I cannot keep on using Julia. I can use many packages from Python which are still not existed in Julia. Thanks for your great work!

 ![捕获](https://global.discourse-cdn.com/julialang/original/3X/1/1/118ff7bc609d8a55239366a0e6e6e9ed46dc1ae0.png)

---

<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:** [July 28, 2017, 8:03pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/9 "2017-07-28T20:03:18Z")

</div>

As I said, these are not deprecation warnings…

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 28, 2017, 8:04pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/10 "2017-07-28T20:04:19Z")

</div>

> [@zhangliye](#):
>
> However, the warnings are still there.

Yes, as @kristoffer.carlsson pointed out, the specific warnings you are showing are not deprecation warnings, so they won’t be affected by `--depwarn=no`.

You might try upgrading to Julia 0.6. Not only is Julia 0.6 better than 0.5 in many ways, it also does not emit a warning for redefining a method in the Main namespace (the one used for interactive definitions): [don't warn about redefining methods in Main by stevengj · Pull Request #19888 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/19888)

---

<div class="post-metadata">

**Author:** ![zhangliye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhangliye/32/3208_2.png) [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Post date:** [July 28, 2017, 8:06pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/11 "2017-07-28T20:06:41Z")

</div>

Thanks for your reminding! In fact, I want to suppress all warnings including deprecation warnings, which make the notebook page ugly.

---

<div class="post-metadata">

**Author:** ![zhangliye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhangliye/32/3208_2.png) [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Post date:** [July 28, 2017, 8:10pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/12 "2017-07-28T20:10:52Z")

</div>

Thanks! I have tried. But there are still other warnings. In fact, I want to suppress all warnings to make the IJulia notebook clean.

 ![捕获](https://global.discourse-cdn.com/julialang/original/3X/a/6/a62c6e7c36e7ba0c9fa31861cde70c15443a61cb.png)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 28, 2017, 8:31pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/13 "2017-07-28T20:31:50Z")

</div>

> [@zhangliye](#):
>
> But there are still other warnings

That should be fixed: just like we don’t warn for redefining methods in `Main`, we shouldn’t warn for redefining docstrings in `Main`. I’ll look into filing a PR: [don't warn about redefining docstrings in Main · Issue #23011 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/23011)

In the meantime, however, the presence of all of these warning suggests that you may have a coding style that is not idiomatic for Julia. Why are you including code files that redefine the same functions over and over?

---

<div class="post-metadata">

**Author:** ![zhangliye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhangliye/32/3208_2.png) [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Post date:** [July 28, 2017, 8:46pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/14 "2017-07-28T20:46:46Z")

</div>

@stevengj Thanks for your suggestion. Most of the time, the warnings indicate the potential improper coding.

The “redefine the same functions” may be caused by two reasons  
(a) I “include()” code files repeatedly in the \*.jl files. (b) It is related to the workflow. I edit the code files in Juno and call the functions and check the result in IJulia. If the result is not good enough, I revise the code in Juno and “include()” the code file in IJulia again. I found this workflow is quite convenient for me.

Thank you so much. I will check my code.

---

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [July 29, 2017, 4:10pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/15 "2017-07-29T16:10:11Z")

</div>

[https://github.com/cstjean/ClobberingReload.jl#silencing-warnings](https://github.com/cstjean/ClobberingReload.jl#silencing-warnings) ? You could also use `no_warnings() do; include(...) end` to remove all of them. Or [https://github.com/Ismael-VC/Suppressor.jl](https://github.com/Ismael-VC/Suppressor.jl). It was a common ailment in Julia 0.5.

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [December 17, 2017, 2:39pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/16 "2017-12-17T14:39:04Z")

</div>

Suppressor.jl is AWESOME! Finally a clean notebook!

---

<div class="post-metadata">

**Author:** ![diadora77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diadora77/32/220469_2.png) [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Post date:** [May 16, 2021, 9:46pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/17 "2021-05-16T21:46:30Z")

</div>

For global suppression of logging at different levels such as debug, info, warn, or error, use the following (I’ve confirmed that it works in iJulia in Jupyter Lab/Notebook):

```julia
Logging.disable_logging(Logging.Info)

```

This suppresses all messages/logging for debug and info. This can be referenced in Julia docs [logging](https://docs.julialang.org/en/v1/stdlib/Logging/#Logging.disable_logging).

---

<div class="post-metadata">

**Author:** ![tfiers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tfiers/32/32427_2.png) [@tfiers](https://discourse.julialang.org/u/tfiers)\
**Post date:** [January 31, 2022, 4:14pm UTC](https://discourse.julialang.org/t/how-to-suppress-hide-all-the-warnings-in-ijulia-or-julia-language/5110/18 "2022-01-31T16:14:56Z")

</div>

…and for more precise suppression, use the filtered loggers from LoggingExtras.jl.  
e.g. the following demo is very applicable:  
[https://github.com/JuliaLogging/LoggingExtras.jl#activefilteredlogger-filter](https://github.com/JuliaLogging/LoggingExtras.jl#activefilteredlogger-filter)

(Posting this here as this page is the top google result for “julia ignore warning”; and it was the solution that worked for me, after trying the above).
