2

I don't seem to be able to get the octave magic running in ipython. I've installed gnu octave, and (after importing oct2py) I can use oct2py.octave in canopy. When I launch ipython and issue the command

In [5]: %load_ext octavemagic

I get a return prompt, and %lsmagic says %octave is available. But when I go to actually use octave, e.g.,

In [7]: x = %octave [1 2; 3 4];

ipython just hangs.

I'm running Canopy 1.4.1.1975 on a MacBook with OSX 10.7.5. From the package manager, I've installed ipython 2.1.0-3. Any ideas?

Suever
  • 64,497
  • 14
  • 82
  • 101
Nesh
  • 21
  • 1
  • Can you please also provide details about which version of octave and oct2py you have installed? – cel Jul 28 '14 at 16:45

1 Answers1

2

octavemagic is now a part of the oct2py package. Please see if this works for you:

%load_ext oct2py.ipython
x = %octave [1 2; 3 4];
x

For me this prints the expected result:

array([[ 1.,  2.],
       [ 3.,  4.]])

Tested with oct2py-1.6.0 and octave-3.8.1 on a linux system.

cel
  • 30,017
  • 18
  • 97
  • 117
  • It's no different, x = %octave [1 2; 3 4] – Nesh Aug 12 '14 at 23:21
  • I've upgraded my mac to 10.9.2 (but the problem is the same as when I was running 10.7). The version of octave is 3.8.0, downloaded from http://wiki.octave.org/Octave_for_MacOS_X#Binary_installer_for_OSX_10.9.1. I have oct2py 1.6.0 installed. – Nesh Aug 12 '14 at 23:30
  • Now, oct2py doesn't work in canopy either. When I say "import oct2py", canopy says "Please install GNU Octave and put it in your path". But I've put what I think are the right commands in .bash_profile, i.e. export PATH=$PATH:/usr/local/octave/3.8.0/bin export PATH=$PATH:/Library/Frameworks/EPD64.framework/Versions/Current/bin export PATH=$PATH:/Applications/MATLAB_R2011a.app/bin – Nesh Aug 13 '14 at 00:16
  • You can check if the octave binary is in your path by typing `which -a octave` in a terminal. If it is, the path to the octave binary will be printed on your console. Is octave installed at `/usr/local/octave/3.8.0/bin`? – cel Aug 13 '14 at 06:55