5

Final edit: adding

export PATH=/usr/local/octave/3.8.0/bin:$PATH

to my path was indeed sufficient to enable oct2py to work properly (so long as I restarted my terminal after the change). Huzzah!

---- Original post ----

I have successfully pip installed oct2py and pexpect, but am running into issues when trying to import and use oct2py. First, when trying the following:

import oct2py

I received the following error message:

Please install GNU Octave and put it in your path

So I added the following lines to ~/usr/.bash_profile

export PATH=/usr/local/octave-3.8.0/bin:${PATH}
export PATH=/usr/local/octave-3.8.0/sbin:${PATH}

And now I am able to successfully import the oct2py module in python. However, when trying to initialize it with:

oc = oct2py.Oct2Py()

I get the same error message as before. What more do I need to add to the PATH to tell python how to actually run Octave? Is there perhaps another issue that I'm not aware of?

Edit: It appears that the initial 'import oct2py' still fails to recognize the PATH, but if I run that line a second time, it does not raise the same error message again. So presumably the PATH lines I've added already are not actually doing anything.

Suever
  • 64,497
  • 14
  • 82
  • 101
djsensei
  • 193
  • 1
  • 2
  • 9
  • Are you sure the installation order doesn't matter? I'm not familiar with `oct2py`, but the natural thing to do is to first install GNU Octave and put it into the PATH, and only after install the Python package. I'm very busy right now for reading the docs, sorry. – juliohm May 20 '14 at 11:14
  • I uninstalled oct2py and then reinstalled it (after ensuring the PATH was set as I specified above) and the problem remains. – djsensei May 20 '14 at 16:58
  • Any reason for setting the PATH in `.bash_profile` rather than `.bashrc`? They have different purposes. – juliohm May 20 '14 at 19:14
  • I admittedly know very little about PATH, so what is in there so far is either automatically written in (say, by my Anaconda build) or added as a hacky solution to some previous problem. Additionally, I am embarrassed to note that I just solved the entire problem by closing my terminal and opening a new one. :p – djsensei May 20 '14 at 20:27
  • Glad you solved the problem - could you write your solution as an answer and accept it, so that the question is marked closed? – ali_m May 21 '14 at 00:27

1 Answers1

3

Adding the following to .bash_profile enables oct2py to work properly.

export PATH=/usr/local/octave/3.8.0/bin:$PATH

Just make sure to restart the terminal after you update the PATH file!

djsensei
  • 193
  • 1
  • 2
  • 9