Reputation: 1
The error occurs when I try to import the oct2py package. Here's my code:
import oct2py
Here's the error that I get:
Traceback (most recent call last):
File "c:\Users\samke\___\___\___\test.py", line 1, in <module> # I blanked out the path for privacy
import oct2py
File "C:\Users\samke\AppData\Local\Programs\Python\Python310\lib\site-packages\oct2py\__init__.py", line 38, in <module>
octave = Oct2Py()
File "C:\Users\samke\AppData\Local\Programs\Python\Python310\lib\site-packages\oct2py\core.py", line 83, in __init__
self.restart()
File "C:\Users\samke\AppData\Local\Programs\Python\Python310\lib\site-packages\oct2py\core.py", line 533, in restart
self._engine = OctaveEngine(stdin_handler=self._handle_stdin,
File "C:\Users\samke\AppData\Local\Programs\Python\Python310\lib\site-packages\octave_kernel\kernel.py", line 176, in __init__
self.repl = self._create_repl()
File "C:\Users\samke\AppData\Local\Programs\Python\Python310\lib\site-packages\octave_kernel\kernel.py", line 402, in _create_repl
repl = REPLWrapper(cmd, orig_prompt, change_prompt,
File "C:\Users\samke\AppData\Local\Programs\Python\Python310\lib\site-packages\metakernel\replwrap.py", line 61, in __init__
self.child = pexpect.spawnu(cmd_or_spawn, echo=echo,
File "C:\Users\samke\AppData\Local\Programs\Python\Python310\lib\site-packages\metakernel\pexpect.py", line 29, in spawn
child = PopenSpawn(command, timeout=timeout, maxread=maxread,
File "C:\Users\samke\AppData\Local\Programs\Python\Python310\lib\site-packages\pexpect\popen_spawn.py", line 53, in __init__
self.proc = subprocess.Popen(cmd, **kwargs)
File "C:\Users\samke\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\samke\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1438, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application
PS C:\Users\samke\Dev\Trading_Program\ML>
If it helps, I'm running python 3.10.5.
Thanks all!
Edit: I do have octave installed, and octave is on my path, as the oct2py documentation says is necessary.
Upvotes: 0
Views: 1092
Reputation: 49
I had similar problem and I spent half a day looking for a solution. Your problem might be similar to mine, so I will explain my situation and the solution, and hopefully, it will help solving your issue as well.
C:\octave-7.1.0-w64
C:\octave-7.1.0-w64\mingw64\bin
to the environment variables.
(run: edit environment variables for your account and edit the path field there).
The reason is that, octave.exe
is located in this path, and this what we need to run octave in the console mode.octave
(i.e. calling octave.exe).
At this point, I got an error message. And this what caused that error when calling octave from oct2py.C:\octave-7.1.0-w64
and run the script post-install.bat
. This adds and updates octave packages.octave:1>
. This indicates that octave is ready to be called from oct2py without any issue.import oct2py
. It executed successfully.I repeated the same procedure on two different devices and it works.
Upvotes: 0