Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPython autoreload magic function not found

Tags:

ipython

I have used the following scripts in an iPython notebook to enable autoreload.

import autoreload

%autoreload

The import works find but the magic function throws the following error:

ERROR: Line magic function `%autoreload` not found.

Here are the current version settings as per the notebook 'about' section:

Python 2.7.3 (default, Jun 22 2015, 19:33:41) 
[GCC 4.6.3]
IPython 4.1.2 -- An enhanced Interactive Python.

Any pointers on what the issue could be would be appreciated.

Thanks

like image 739
Estee Avatar asked Apr 12 '16 11:04

Estee


People also ask

What is Autoreload in IPython?

IPython extension to reload modules before executing user code. autoreload reloads modules automatically before entering the execution of code typed at the IPython prompt.

How do you reload a Jupyter notebook?

Simple solution: Use the autoreload to make sure the latest version of the module is used. The autoreloading module is not enabled by default. So you have to load it as an extension. And each time you execute some code, IPython will reimport all the modules to make sure that you are using the latest possible versions.


1 Answers

If you are using this in IPython notebook

This command will load autoreload:

%load_ext autoreload

This line will reload pandas (replace pandas with the module name you would like to reload) every time code is run:

%aimport pandas

If you wish to remove pandas from reloading every time you run code then, this line will stop pandas from reloading:

%aimport -pandas

Include %autoreload at the top the cell for the magic to happen!

autoreload Reference

like image 77
Alok Reddy Kattangoori Avatar answered Sep 22 '22 08:09

Alok Reddy Kattangoori