How to update kernmagic to fix this ipython error?

I recently updated the Enthought Python distribution using

sudo easy_install -U ipython

However, when I start ipython using the command ipython, I get an error message:

David-Faux-MacBook-Air:core davidfaux$ ipython
Python 2.7.2 |EPD 7.2-2 (32-bit)| (default, Sep  7 2011, 09:16:50) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython features.
%quickref -> Quick reference.
help      -> Python own help system.
object?   -> Details about 'object', use 'object??' for extra details.
[TerminalIPythonApp] Error in loading extension: kernmagic
Check your config files in /Users/davidfaux/.ipython/profile_default
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/ipython-0.13.1-py2.7.egg/IPython/core/extensions.pyc in load_extension(self, module_str)
     90                 __import__(module_str)
     91         mod = sys.modules[module_str]
---> 92         return self._call_load_ipython_extension(mod)
     93 
     94     def unload_extension(self, module_str):

/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/ipython-0.13.1-py2.7.egg/IPython/core/extensions.pyc in _call_load_ipython_extension(self, mod)
    122     def _call_load_ipython_extension(self, mod):
    123         if hasattr(mod, 'load_ipython_extension'):
--> 124             return mod.load_ipython_extension(self.shell)
    125 
    126     def _call_unload_ipython_extension(self, mod):

/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/kernmagic/__init__.py in load_ipython_extension(ip)
     28 
     29 def load_ipython_extension(ip):
---> 30     activate(ip)
     31     activate_aliases(ip)

/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/kernmagic/__init__.py in activate(ip, *args)
     14             continue
     15         magic_name = name[len('magic_'):]
---> 16         ip.shell.define_magic(magic_name, getattr(mymagics, name))
     17 
     18 def activate_aliases(ip, *args):

AttributeError: 'TerminalInteractiveShell' object has no attribute 'shell'

I googled around and many of the posts I found said to comment on this line in the ipython configuration file.

c.TerminalIPythonApp.extensions = ['kernmagic']

I find this sketchy to comment on the ipython file, though ... later I found that I kernmagic fixed the problem using ipython.

How do I update kernmagicipython in my distribution so that this error disappears?

+5
source share
6 answers

This worked for me:

hg clone https://bitbucket.org/robertkern/kernmagic
cd kernmagic
python setup.py build
python -c "import setuptools;execfile('setup.py')" bdist_egg
egginst dist/kernmagic-0.0.0-py2.7.egg
+5
source

/ , , kernmagic. .ipython/profile_xxx , - .

, , , .

, IIRC IPython EPD, .

+3

, EPD- python ( Rich- ):

, Python 2.7.5 | Anaconda 1.6.0 (x86_64) |, Mac OS X 10.8.4.

, , :

# A list of dotted module names of IPython extensions to load.
c.TerminalIPythonApp.extensions = ['kernmagic']

:

~/.ipython/profile_default/ipython_config.py

1/3 . , - , kernmagic, ipython.

+3

, Windows, ,

C:\Users\Li\.ipython\profile_default\ipython_config.py

, , :

# A list of dotted module names of IPython extensions to load.
c.TerminalIPythonApp.extensions = ['kernmagic']
+1

Enthought kernmagic, Enthought enpkg EPD 7.3 ipython 0.13.1:

sudo enpkg kernmagic
0

kernmagic python3. , python-2.x.

. , , kernlab . , python, .

!

0

All Articles