0

I'm trying to use oct2py in one of my python scripts, I have octave installed in C:\Octave\Octave-4.2.1 and have added C:\Octave\Octave-4.2.1 to my PATH variable for my user account. When I run from oct2py import octave I get the following error:

Traceback (most recent call last):
  File "C:\Users\CVanCleef\Desktop\cvancleef reconstruction\filterTestin.py", line 12, in <module>
    from oct2py import octave
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\__init__.py", line 38, in <module>
    octave = Oct2Py()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\core.py", line 73, in __init__
    self.restart()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\core.py", line 508, in restart
    logger=self.logger)
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\octave_kernel\kernel.py", line 144, in __init__
    self.repl = self._create_repl()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\octave_kernel\kernel.py", line 338, in _create_repl
    version = subprocess.check_output(version_cmd).decode('utf-8')
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 316, in check_output
    **kwargs).stdout
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 383, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 955, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

EDIT: After adding OCTAVE_EXECUTABLE to my path, I get the error

Traceback (most recent call last):
  File "C:\Users\CVanCleef\Desktop\cvancleef reconstruction\filterTestin.py", line 12, in <module>
    from oct2py import octave
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\__init__.py", line 38, in <module>
    octave = Oct2Py()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\core.py", line 73, in __init__
    self.restart()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\core.py", line 508, in restart
    logger=self.logger)
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\octave_kernel\kernel.py", line 144, in __init__
    self.repl = self._create_repl()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\octave_kernel\kernel.py", line 338, in _create_repl
    version = subprocess.check_output(version_cmd).decode('utf-8')
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 316, in check_output
    **kwargs).stdout
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 383, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 955, in _execute_child
    startupinfo)
PermissionError: [WinError 5] Access is denied
  • as I remember it, don't you need to set some sort of `OCTAVE_PATH` environment variable specifically for oct2py? **EDIT:** The [oct2py documentation](http://blink1073.github.io/oct2py/source/installation.html) mentions at the bottom of the page: "Alternatively, you can specify the path to your Octave executable by creating an OCTAVE_EXECUTABLE environmental variable." – Tasos Papastylianou Jul 20 '17 at 14:22
  • I added OCTAVE_EXECUTABLE to my path, I now have a different error that appears to be happening in the same spot –  Jul 20 '17 at 15:10

2 Answers2

1

Have you restarted your system after changing the PATH variable?

I have had this issue before when loading in a different module and resolved it by restarting my system.

Eole Lake
  • 11
  • 1
1

Fixed by adding a path variable OCTAVE_EXECUTABLE and and setting the OCTAVE_EXECUTABLE value to C:\Octave\Octave-4.2.1\bin\octave-cli.exe. I also removed the octave reference from my PATH

  • That doesn't make sense (since path needs to be a directory). Presumably you mean "I set the path to `C:\Octave\Octave-4.2.1\bin` and OCTAVE_EXECUTABLE to `C:\Octave\Octave-4.2.1\bin\octave-cli.exe`"? In any case, you probably only needed to do one or the other. – Tasos Papastylianou Jul 20 '17 at 16:18
  • Thanks, poor wording by me –  Jul 20 '17 at 16:45