In Windows 10 or 11, I am trying to set up a Python/Oct2Py/Octave environment so that I can write Python scripts that can invoke Octave functionality. I set this up on my own machine, and got it working about a year ago. Now I am trying to replicate this setup, but my notes must be somewhat deficient, as I run into errors doing the simplest tasks. For example, in the Octave CLI, I can run this command: octave:1> pwd() ans = C:\Users\bob In my working Anaconda Powershell, I can run this equivalent: (base) PS C:\Users\bob> python Python 3.9.12 (main, Apr 4 2022, 05:23:19) [MSC v.1916 32 bit (Intel)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from oct2py import Oct2Py >>> o = Oct2Py() >>> o.pwd() 'C:\\Users\\bob' >>> However, in my new setup, I run into problems: (base) PS C:\Users\rsg> python Python 3.9.12 (main, Apr 4 2022, 05:23:19) [MSC v.1916 32 bit (Intel)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from oct2py import Oct2Py >>> o = Oct2Py() >>> o.pwd() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\dynamic.py", line 111, in __call__ return self._ref().feval(self.name, *inputs, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\core.py", line 403, in feval return self._feval( File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\core.py", line 620, in _feval write_file(req, out_file, oned_as=self._oned_as, convert_to_float=self.convert_to_float) File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\io.py", line 58, in write_file data = _encode(obj, convert_to_float) File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\io.py", line 351, in _encode out[key] = _encode(value, ctf) File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\io.py", line 376, in _encode if isinstance(data, spmatrix): NameError: name 'spmatrix' is not defined >>> In both cases, all the software is the same: Windows 11 Home Anaconda (2022.05 - Python 3.9.12) Oct2Py (installed via "conda install -c conda-forge oct2py") Octave 8.2.0 I cannot figure out what is going on with the new install (I've tried it on three separate machines, and they all fail). Continue reading...