When trying to import simulai.rom.POD on a python 3.8.10 fresh environment in a Windows 11 computer, I run into a type error:
>>> from simulai.rom import POD
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\kaoid\.virtualenvs\testEnv-tTjwCpEs\lib\site-packages\simulai\rom\__init__.py", line 19, in <module>
from ._rom import DMD, GPOD, HOSVD, IPOD, POD, QQM, ROM, ByPassROM, IByPass
File "C:\Users\kaoid\.virtualenvs\testEnv-tTjwCpEs\lib\site-packages\simulai\rom\_rom.py", line 26, in <module>
from simulai.optimization import SpaRSA
File "C:\Users\kaoid\.virtualenvs\testEnv-tTjwCpEs\lib\site-packages\simulai\optimization\__init__.py", line 23, in <module>
from ._losses import *
File "C:\Users\kaoid\.virtualenvs\testEnv-tTjwCpEs\lib\site-packages\simulai\optimization\_losses.py", line 23, in <module>
from simulai.io import IntersectingBatches
File "C:\Users\kaoid\.virtualenvs\testEnv-tTjwCpEs\lib\site-packages\simulai\io.py", line 1306, in <module>
class SlidingWindow:
File "C:\Users\kaoid\.virtualenvs\testEnv-tTjwCpEs\lib\site-packages\simulai\io.py", line 1401, in SlidingWindow
) -> tuple[np.ndarray, np.ndarray]:
TypeError: 'type' object is not subscriptable
The same error shows up when trying to import simulai.io.Reshaper and simulai.simulation.Pipeline, always with the same last item on the stack trace, pointing to tuple[np.ndarray, np.ndarray] in line 1401 of file simulai/io.py.
Hi. It seems to be a problem related to a syntax confusion. It was replaced by the typing class Tuple in the commit 22594f8f724e5ac613baad601d0a31ccbdcac47f.
When trying to import
simulai.rom.POD
on a python 3.8.10 fresh environment in a Windows 11 computer, I run into a type error:The same error shows up when trying to import
simulai.io.Reshaper
andsimulai.simulation.Pipeline
, always with the same last item on the stack trace, pointing totuple[np.ndarray, np.ndarray]
in line 1401 of file simulai/io.py.A quick google search led me to this TensorFlow Federated (TFF) issue, suggesting this problem may be solved by upgrading python version. And, among the new features of python 3.9.0, is PEP 585 – Type Hinting Generics In Standard Collections.
After upgrading the python version to 3.9.13 (lastest 3.9.x with windows binaries 🙂), these problems were solved.
My only suggestion then is that the description "Python version requirements: 3.8 <= python <= 3.10" in the readme is updated.