2021-04-02 04:57 AM
With a fresh installation of STM32CubeIDE 1.6.1 on a clean WIndows 10 Pro 20H2, after adding X-CUBE-AI 6.0.0 to a new STM32 project, Analyze fails with:
ImportError: cannot import name 'get_all_providers' from 'onnxruntime.capi._pybind_state' (C:\Users\Utilisateur\STM32Cube\Repository\Packs\STMicroelectronics\X-CUBE-AI\6.0.0\Utilities\windows\onnxruntime\capi\_pybind_state.pyc)
On ArchLinux (not a clean installation), the error does not seem to occur.
How to reproduce:
Create a new STM32 project.
In the board selector choose (for example) Nucleo-L452RE-P, validate project creation.
Add the X-CUBE-AI 6.0.0 software pack to the project with the Validation application template.
Create a new network and import your model (Keras used here).
Try to Analyze
Actual behaviour:
Analyze fails with:
Analyzing model
C:/Users/Utilisateur/STM32Cube/Repository/Packs/STMicroelectronics/X-CUBE-AI/6.0.0/Utilities/windows/stm32ai analyze --name network -m C:/Users/Utilisateur/Documents/d1-notebooks/mnist_lenet5.h5 --type keras --compression 1 --verbosity 1 --workspace C:\Users\UTILIS~1\AppData\Local\Temp\mxAI_workspace16985705420013710289337304763638 --output C:\Users\Utilisateur\.stm32cubemx
[4392] Failed to execute script stm32ai
C:\Users\Utilisateur\STM32Cube\Repository\Packs\STMicroelectronics\X-CUBE-AI\6.0.0\Utilities\windows\onnxruntime\capi\_pybind_state.py:14: UserWarning: Cannot load onnxruntime.capi. Error: 'DLL load failed: The specified module could not be found.'.
Traceback (most recent call last):
File "stm32ai.py", line 959, in <module>
File "c:\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
File "onnxruntime\__init__.py", line 13, in <module>
ImportError: cannot import name 'get_all_providers' from 'onnxruntime.capi._pybind_state' (C:\Users\Utilisateur\STM32Cube\Repository\Packs\STMicroelectronics\X-CUBE-AI\6.0.0\Utilities\windows\onnxruntime\capi\_pybind_state.pyc)
Expected behaviour:
Analyze proceeds without error.
Temporary workaround:
Downgrade to X-CUBE-AI 5.2.0. With this version, Analyze completes successfully.
2021-04-19 03:13 AM
Solution:
Install the Microsoft Visual C++ 2015-2019 Redistributable from https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0 .