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
IPython extension to reload modules before executing user code. autoreload reloads modules automatically before entering the execution of code typed at the IPython prompt.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With