Re: ipython notebook config options ignored unless placed in regular config file
MinRK <[email protected]> Sat, 18 Apr 2015 17:26:52 -0700
| Newsgroups | gmane.comp.python.ipython.user |
|---|---|
| Message-ID | <CAHNn8BVBdfAnm2pgNZexuy1jG7MhwR3xisXXNy7XzoQXLrN3ew@mail.gmail.com> |
ipython_config.py is loaded by all IPython applications (terminal IPython, notebook server, kernel, qtconsole, etc.). Each application will then load its own config file, giving it a higher priority than anything in ipython_config.py. ipython_notebook_config.py only configures the IPython notebook server process. It has no effect on the kernel process, where you want to load extensions. ipython_kernel_config.py configures the kernel process, etc. -MinRK On Sat, Apr 18, 2015 at 5:14 PM, Rob Clewley <[email protected]> wrote: > Hi, > > I'm using OS X 10.6.8 with ipython that I upgraded from v1 (from fink) > to 3.0.0 (using pip). Everything seems to work fine, except an issue > with configuration. > > >From the documentation and my own testing, I am having trouble > understanding the expected behavior of config options in my > .ipython/profile_default/ipython_config.py versus the > ipython_notebook_config.py. > > I want to auto-load a couple of extensions and modules for my > notebooks but not for my regular ipython sessions (partly because > those loads create warnings, but it just seems that I'm supposed to be > able to keep these configurations separate). It seemed to make sense > that config options that apply only to the notebook go in the notebook > config. But I can only get the notebook to honour my choices when I > put the options in ipython_config.py. It seems to ignore the notebook > config, and I am stuck with non-notebook ipython also loading these > modules. Am I doing something wrong? > > The documentation does not explicitly address the distinctions, and > the inline comments in these files do not make reference to the > distinction between these two config files, only to inheritance of > TerminalIPythonApp from Application and InteractiveShellApp (but same > class names in both config files). What is the rule for notebook > config reading? Does ipython read from one first, then the other? > Currently, it seems to ignore the ipython_notebook_config.py > altogether, so why is it there? > > Maybe it's related to this from 2013: > http://mail.scipy.org/pipermail/ipython-user/2013-February/012170.html > But the commit that fixed his problem is in the master repo now, so > maybe not... > > The result of ipython notebook --debug is > > [D 10:37:52.595 NotebookApp] Config changed: > [D 10:37:52.595 NotebookApp] {'NotebookApp': {'log_level': 10}} > [D 10:37:52.596 NotebookApp] IPYTHONDIR set to: /Users/robclewley/.ipython > [I 10:37:52.598 NotebookApp] Using existing profile dir: > u'/Users/robclewley/.ipython/profile_default' > [D 10:37:52.598 NotebookApp] Searching path > > [u'/Users/robclewley/Work/literate_modeling/scenario-local-linear/notebook/project', > u'/Users/robclewley/.ipython/profile_default', > '/usr/local/etc/ipython', '/etc/ipython'] for config files > [D 10:37:52.598 NotebookApp] Attempting to load config file: > ipython_config.py > [D 10:37:52.600 NotebookApp] Loaded config file: > /Users/robclewley/.ipython/profile_default/ipython_config.py > [D 10:37:52.601 NotebookApp] Config changed: > [D 10:37:52.601 NotebookApp] {'TerminalInteractiveShell': {'logstart': > True}, 'NotebookApp': {'log_level': 10}, 'TerminalIPythonApp': > {'matplotlib': 'osx'}} > [D 10:37:52.602 NotebookApp] Attempting to load config file: > ipython_notebook_config.py > [D 10:37:52.604 NotebookApp] Loaded config file: > /Users/robclewley/.ipython/profile_default/ipython_notebook_config.py > [D 10:37:52.605 NotebookApp] Config changed: > [D 10:37:52.605 NotebookApp] {'TerminalInteractiveShell': {'logstart': > True}, 'NotebookApp': {'log_level': 10}, 'InteractiveShellApp': > {'exec_lines': ['import notebook_importing'], 'gui': 'osx', 'pylab': > 'osx', 'matplotlib': 'osx', 'extensions': ['yaml_magic', > 'autoreload'], 'extra_extension': 'yaml_magic'}, 'TerminalIPythonApp': > {'extra_extension': 'yaml_magic', 'extensions': ['yaml_magic'], > 'matplotlib': 'osx'}} > [D 10:37:52.611 NotebookApp] searching for local mathjax in > [u'/Users/robclewley/.ipython/nbextensions', > '/sw/share/jupyter/nbextensions', > '/usr/local/share/jupyter/nbextensions', > '/usr/share/jupyter/nbextensions'] > [D 10:37:52.613 NotebookApp] searching for local mathjax in > [u'/Users/robclewley/.ipython/profile_default/static', > '/sw/lib/python2.7/site-packages/IPython/html/static'] > [I 10:37:52.613 NotebookApp] Using MathJax from CDN: > https://cdn.mathjax.org/mathjax/latest/MathJax.js > > For instance, invoking the magic command %%yaml (from my custom > extension) in the notebook results in a complaint that the command is > not recognized. If, instead, I set these extensions to be loaded in > ipython_config.py, then the notebook accepts %%yaml immediately. In > this case, the debug output is: > > [D 10:46:50.330 NotebookApp] Config changed: > [D 10:46:50.330 NotebookApp] {'NotebookApp': {'log_level': 10}} > [D 10:46:50.331 NotebookApp] IPYTHONDIR set to: /Users/robclewley/.ipython > [I 10:46:50.332 NotebookApp] Using existing profile dir: > u'/Users/robclewley/.ipython/profile_default' > [D 10:46:50.332 NotebookApp] Searching path > > [u'/Users/robclewley/Work/literate_modeling/scenario-local-linear/notebook/project', > u'/Users/robclewley/.ipython/profile_default', > '/usr/local/etc/ipython', '/etc/ipython'] for config files > [D 10:46:50.332 NotebookApp] Attempting to load config file: > ipython_config.py > [D 10:46:50.335 NotebookApp] Loaded config file: > /Users/robclewley/.ipython/profile_default/ipython_config.py > [D 10:46:50.336 NotebookApp] Config changed: > [D 10:46:50.337 NotebookApp] {'TerminalInteractiveShell': {'logstart': > True}, 'NotebookApp': {'log_level': 10}, 'InteractiveShellApp': > {'extensions': ['yaml_magic', 'autoreload']}, 'TerminalIPythonApp': > {'matplotlib': 'osx'}} > [D 10:46:50.337 NotebookApp] Attempting to load config file: > ipython_notebook_config.py > [D 10:46:50.338 NotebookApp] Loaded config file: > /Users/robclewley/.ipython/profile_default/ipython_notebook_config.py > [D 10:46:50.339 NotebookApp] Config changed: > [D 10:46:50.340 NotebookApp] {'TerminalInteractiveShell': {'logstart': > True}, 'NotebookApp': {'log_level': 10}, 'InteractiveShellApp': > {'extra_extension': 'yaml_magic', 'extensions': ['yaml_magic', > 'autoreload'], 'exec_lines': ['import notebook_importing'], 'gui': > 'osx', 'pylab': 'osx', 'matplotlib': 'osx'}, 'TerminalIPythonApp': > {'extra_extension': 'yaml_magic', 'extensions': ['yaml_magic'], > 'matplotlib': 'osx'}} > [D 10:46:50.345 NotebookApp] searching for local mathjax in > [u'/Users/robclewley/.ipython/nbextensions', > '/sw/share/jupyter/nbextensions', > '/usr/local/share/jupyter/nbextensions', > '/usr/share/jupyter/nbextensions'] > [D 10:46:50.345 NotebookApp] searching for local mathjax in > [u'/Users/robclewley/.ipython/profile_default/static', > '/sw/lib/python2.7/site-packages/IPython/html/static'] > > Thanks. > _______________________________________________ > IPython-User mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/ipython-user > _______________________________________________ IPython-User mailing list [email protected] http://mail.scipy.org/mailman/listinfo/ipython-user