darKoram
darKoram

Reputation: 1143

ipython octavemagic

I'm on ubuntu with python 2.7

according to the documentation I should be able to get octave running from ipython:

%install_ext octavemagic
%load_ext octavemagic

('The file must have a .py or .zip extension', u'octavemagic')

If I try:

%install_ext bash.py
IOError                                   Traceback (most recent call last)
<ipython-input-5-36b60e02c7c6> in <module>()
----> 1 get_ipython().magic(u'install_ext bash.py')

Complete trace here

%lsmagic gives a lot of magics and i tried %%timeit arange(1000) and it worked fine.

Finally, I tested the magic at the ipython commandline, as opposed to notebook; %octave x = [1,2;3,4] worked just fine.

I'd really like to get octave running from ipython notebook. Any ideas of where to investigate?

octavemagic.py is in <myinstall_directory>/IPython/extensions/octavemagic.py as are the others i tried that failed. My steps: according to http://ipython.org/ipython-doc/stable/config/extensions/octavemagic.html

  1. $ easy_install oct2py (no problem)
  2. $ easy_install h5py
    h5py/api_compat.h:21:18: fatal error: hdf5.h: No such file or directory (I do have it in a couple of places (octave and another 3rd party lib. Found others who said that h5py is broken wrt hdf5.h, so I tried a full lib-dev install)

    $sudo apt-get libhdf5-serial-dev $sudo easy_install h5py Installed /usr/local/lib/python2.7/dist-packages/h5py-2.0.1-py2.7-linux-x86_64.egg Processing dependencies for h5py Finished processing dependencies for h5py

  3. Discovered I had a thin (notebook only?) version of ipython, so I installed the source from git and build it. Yes. I built it. 8)

  4. sudo easy_install nose pexpect irunner and ipython-dev
  5. launch notebook with ipython notebook -pylab inline Notebook starts and things work, except for the %magic octavemagic. Also doesn't work for %magic bash or several others in

Upvotes: 3

Views: 2362

Answers (1)

darKoram
darKoram

Reputation: 1143

Quite right, octavemagic is bundled with standard octave install, so all that is required is

%load_ext octavemagic

my ipython commandline and notebook must be the same cause the only difference is:

> ipython
vs
> ipython notebook --pylab inline

I re-started the notebook and tried again. Now %load_ext octavemagic works. Perhaps i was just confused before by the errors associated with mistakenly trying to install Would be good if octave gave a message like "already installed" rather than the error with traceback as in the link.

Upvotes: 1

Related Questions