2

I have installed the oct2py package using the pip command pip install oct2py, set the environement path of python, pip and octave as in the following picture:

paths

However, whenever I try to import it in my python script, I get the following error:

error

I checked whether the package is installed, it says: Requirement satisfied.

Any ideas of what I could possibly be doing wrong?

Wallflower
  • 550
  • 1
  • 4
  • 13
  • The last error says "it's not a valid **32** bit application". I note that your octave path points to a **64** bit application. Perhaps you downloaded the wrong version of octave / linked to the wrong bin directory? – Tasos Papastylianou Jan 19 '21 at 13:36
  • Everything is installed for my 64bits... I have double checked.. – Wallflower Jan 20 '21 at 11:14
  • It's going to be a 32/64 bit issue, it always is – David Heffernan Jan 20 '21 at 14:14
  • Well, I just don't seem to figure it out by myself :( Three days now... – Wallflower Jan 20 '21 at 15:05
  • 2
    @Wallflower There are three possibilities. Either the octave executable you've linked to is not the right 'bits', or you don't have the right permissions to run it (unlikely on windows...), or it's not an executable file in the first place. Without knowing your setup it's impossible to know. You could try debugging using pdb; do you know how to use it? E.g. type `import pdb; pdb.pm()` immediately after the error, and inspect the local variables (in this case it looks like it will be the variable `executable`). What does that point to? – Tasos Papastylianou Jan 21 '21 at 08:26
  • @TasosPapastylianou following your instruction using pdb I get the following message `c:\program files\python37\lib\subprocess.py(1155)_execute_child() -> startupinfo) (Pdb)` I honestly have no idea what this means... – Wallflower Jan 21 '21 at 11:30
  • 1
    pdb is the python debugger. You should learn how to use it, it's an incredibly valuable skill :) https://realpython.com/python-debugging-pdb/ But for now, once you're in that prompt, type `p executable` to inspect the value of the variable named `executable`. Also `p args` to print the values of the `args` variable at that point. Hopefully this will give us enough of a hint of whether what is being called is somehow not what is intended ... – Tasos Papastylianou Jan 21 '21 at 14:23
  • Looks like a very interesting tool to be used whenever I have a bug. Thank you! for now after printing `p executable` it prints `None`, and `p args` gives `C:/Program Files/GNU Octave/Octave-6.1.0/mingw64/bin/octave-cli.EXE interactive--quiet --no-init-file`. It's worth mentioning that this path uses forward slash instead of backslash (used in Windows). Also, even though I have Octave in my environment variables, when importing the oct2py package I get the error octave executable not found and when I type `octave` in my command prompt it automatically opens Octave. – Wallflower Jan 21 '21 at 18:33
  • what about when you type `octave-cli.EXE` specifically? – Tasos Papastylianou Jan 22 '21 at 18:34
  • I get unknown command... – Wallflower Jan 22 '21 at 21:51
  • 1
    @Wallflower: please tag me if you reply, otherwise I don't get a notification! (only you can be replied to without explicit tagging because you are the post author). As for 'unknown command', there is your problem then. You are trying to call a command that doesn't exist. You need to find out why. Does a command by that name exist at all in the directory identified earlier? Perhaps it uses another name? Maybe it's .exe instead of .EXE? If you go inside that directory and a command by that name exists, can you run it? Is the path definitely correct? (eg is it definitely installed in C: ?) – Tasos Papastylianou Jan 23 '21 at 09:23
  • 1
    @TasosPapastylianou I deinstalled python and started working with Anaconda & Spider, I can now import the package`oct2py` with no problem whatsoever, I have one bug I am dealing with now: `ValueError: not enough values to unpack (expected 2, got 1)` whenever I run my script, it doesn't seem as serious as this one though, I am working on debugging. Thank you so much for your time and answers, I have learned so much with you :D – Wallflower Jan 24 '21 at 10:55

0 Answers0