46

I love Jupyter Notebook. However, it prints many, many updates to the terminal it was started from. For example, every time a file is saved manually or automatically, a line is printed. It makes the terminal virtually useless.

How do I stop it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
saud
  • 773
  • 1
  • 7
  • 20
  • http://stackoverflow.com/questions/14992278/supress-messages-from-ipython-notebook-engine?rq=1 – iayork Nov 06 '15 at 17:25
  • I tried: 'ipython notebook --no-browser --port=443 2> /dev/null > /dev/null' but it did not work. In fact, no notebook is opened. Even tried it without the '--no-browser' option. – saud Nov 06 '15 at 17:36
  • 1
    Start with `jupyter notebook >/dev/null 2>&1` and read up on dev/null redirection – iayork Nov 06 '15 at 17:39
  • 1
    ... that said, I suggest you not try to suppress the output messages. They don't render the terminal unusable, just one window of the terminal -- simply open other windows for other work. Meanwhile the messages that are output from the Jupyter notebook are potentially important and are worth at least glancing at in case of warnings or errors. – iayork Nov 06 '15 at 17:43
  • 2
    Possible duplicate of [Hide all warnings in ipython](https://stackoverflow.com/questions/9031783/hide-all-warnings-in-ipython) – desertnaut Oct 04 '17 at 10:54

5 Answers5

67
import warnings; warnings.simplefilter('ignore')

This would help you get rid of normal warnings.

Qijun Liu
  • 1,685
  • 1
  • 13
  • 11
14

You can easily disable the warnings permanently by just adding the following code:

import warnings
warnings.filterwarnings('ignore')

to the following file:

~/.ipython/profile_default/startup/disable-warnings.py
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rene B.
  • 6,557
  • 7
  • 46
  • 72
1

Add the following on the top of your code,

import warnings;
warnings.filterwarnings('ignore');
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

You should try this:

import warnings

warnings.filterwarnings('ignore')
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

3 lines ...

import warnings
warnings.filterwarnings('ignore')
warnings.simplefilter('ignore')
J R
  • 436
  • 3
  • 7
  • That is more than the other answers. *Why* is that necessary? Please respond by [editing (changing) your answer](https://stackoverflow.com/posts/71857703/edit), not here in comments (***************** ***without*** ***************** "Edit:", "Update:", or similar - the answer should appear as if it was written today). – Peter Mortensen Nov 26 '22 at 21:48