Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable jupyter notebook history

I'm using Jupyter Notebook to code in Python 2. I'm invoking it as:

c:\python27\scripts\jupyter-notebook --no-browser

At the same time I use IPython console, launched with:

c:\python27\scripts\ipython

The problem I have is that Jupyter history is saved and is mixed with IPython history. I don't want Jupyter Notebook history at all - is there a way to disable it, while retaining IPython** history?

Platform: win32

Update:

I have tried to use suggested setting digest approach. But when I enter "c.Session.digest_history_size = 0" to the config, restart notebook, write "print 'next test'" in some cell, restart separate IPython and after pressing up the first thing I get is "print 'next test'".

How can I get rid of it?

like image 671
Robert Gomułka Avatar asked Dec 23 '16 07:12

Robert Gomułka


People also ask

How do I disable jupyter notebook?

You can disable the terminal by setting the CONDUCTOR_JUPYTER_TERMINAL_ENABLED parameter in ascd.

How do I clear my Jupyter memory?

Jupyter Lesson 10: How to reset the Kernel (Clear all in memory objects and stop the code) If the notebook or your code is acting weird sometimes it is best to press the “RESET BUTTON”. Reseting the kernel clears all in memory objects and restarts your code from the very top.

How do I clear my jupyter notebook screen?

When you have Jupyter notebook opened, you can do this by selecting the Cell -> All Output -> Clear menu item.

How do I turn off the jupyter notebook warning?

You can suppress all warnings in the jupyter notebook by using the warnings module and using functions like 'simplefilter()' and 'filterwarnings()'.


1 Answers

See this Jupyter issue on Github for the origin of this solution.

In the Introduction to IPython Configuration using configuration scripts located in your home directory at ~/.ipython/profile_default/ is discussed. This is the relevant directory for the default profile, other similar directories appear if one creates other profiles.

Inside that directory one can include the file ipython_config.py which will run on every usages of IPython. However, the file ipython_kernel_config.py will run upon invocation of an IPython kernel, not when invoking the IPython interpreter itself. One can test this by doing ipython kernel --debug.

Jupyter notebooks use this style of kernel invocation. Therefore including a script ipython_kernel_config.py in the directory ~/.ipython/profile_default/ (assuming the default profile) with the following lines:

# Configuration file for ipython-kernel.

c = get_config()

c.HistoryManager.enabled = False

Should disable the history manager completely when using that style of kernel invocation. Therefore one should not populate command history from Jupyter calls.

Incidentally, the file history.sqlite in that same directory is the command history. So, deleting it or moving it to a different filename will clear the command history buffer.

like image 86
villaa Avatar answered Sep 18 '22 23:09

villaa