oct2py in Anaconda/Spyder not recognizing octave
<p>Windows7</p>

<p>Anaconda/python ver 3.4</p>

<p>Octave ver 4.0.3</p>

<p>OCTAVE_EXECUTABLE = C:\Users\Heather\Octave-4.0.3\bin</p>

<p>Hi all, </p>

<p>I've been working a few days on trying to get oct2py working in Anaconda using Spyder.  I was wondering if anyone could tell me the correct way to get it to work in Spyder on a windows machine?  Basic setup maybe or maybe I'm using the wrong packages?</p>

<p>So far I've installed the oct2py package per the Anaconda Cloud using: </p>

<p>conda install -c conda-forge oct2py=3.5.9</p>

<p>In all the documentation for oct2py it mentioned needing to have Octave downloaded in order for oct2py to work.  So from this page pypi.python.org/pypi/oct2py, it mentioned getting Octave from sourceforge at </p>

<p><a href="https://sourceforge.net/projects/octave/files/Octave%20Windows%20binaries/" rel="nofollow">https://sourceforge.net/projects/octave/files/Octave%20Windows%20binaries/</a> .  </p>

<p>I downloaded the Octave 3.6.4 from there and a friend helped me to get the OCTAVE_EXECUTABLE in my environment variables pointing towards it.  At this point I was able to type 'octave' in a command line and it would bring up an octave instance, but Spyder would never recognize I had octave installed.  </p>

<p>ergo:</p>

<p>from oct2py import octave</p>

<p>Error: cannot import name octave</p>

<p>At this point I realized the sourceforge Octave said it was a supplemental package, so I uninstalled the Octave 3.6.4 and installed Octave 4.0.3 from <a href="http://www.gnu.org/software/octave/" rel="nofollow">http://www.gnu.org/software/octave/</a> for windows.  Now Octave opens nicely when I click on the application but the command line does not recognize the term 'octave' which I feel is a step back.  I looked at my env variables again and the new path for Octave was present in the system variables and I updated the OCTAVE_EXECUTABLE to point to the new version of Octave (with no whitespaces in the directory).  But my computer even after full shutdown and restarts does not recognize 'octave' in the command line and Spyder still does not see that I have octave when I try running oct2py.Oct2Py().</p>

<p>So after all this I was wondering if anyone has gotten oct2py to work in Anaconda but especially using Spyder?  How so?  I am trying to get my python script to open and use a .m file to perform a function and output a matrix that will be used further in the script for computation.  However if I can't even get it to recognize octave then I don't know how I'll get this finished.</p>

<p>Sample of code:</p>

<pre><code>from oct2py import Oct2Py
filename = 'filename'
oc = Oct2Py()
eph_matrix = oc.read_eph(filename)
print(eph_matrix) #nx25 matrix
</code></pre>

<p>I am hopeful if I can just get python to recognize Octave that I can get past the import line.</p>

<p>Any help would be very appreciated.</p>

<p>The <code>OCTAVE_EXECUTABLE</code> or <code>OCTAVE</code> environment variables should point directly to the <em>executable</em> and not the folder that contains the executable. So you'll likely want to set it to </p>

<pre><code>OCTAVE_EXECUTABLE = C:\Users\Heather\Octave-4.0.3\bin\octave-cli.exe
</code></pre>

<p>Another option is to provide the executable as the first input to <code>Oct2Py</code>.</p>

<pre><code>from oct2py import Oct2Py
octave = Oct2Py('C:\Users\Heather\Octave-4.0.3\bin\octave-cli.exe')
</code></pre>

<p>Also, if you want to be able to run it from the Windows command prompt, you will want to add the folder containing the executables (<code>'C:\Users\Heather\Octave-4.0.3\bin'</code>) to the <code>PATH</code> environment variable.</p>

python octave anaconda spyder