As per the documentation, it should be possible to run a python script inside Labels.
However, the file selection drop-box only allows .yaml or .iws files to be selected, python files are not allowed. How should a python file be selected in the run algorithms tool?
Support for .py files is contingent on the ImFusion.Python plugin being loaded. Can you please check the log (it should be in %appdata%/ImFusion/ImFusion Labels on Windows and in ~/.ImFusion on Linux) that this plugin is indeed among the loaded ones. You can also try setting the environment variable IMFUSION_LOG_LEVEL=0 and starting the application from a terminal / cmd to see more detailed logs.
I believe another prerequisite is that the imfusion.labels package is importable from the interpreter / venv used.
Please also double check that you have the correct environment specified in Settings → Python. You can also activate the venv in a terminal / cmd and then launch the application there. It will then automatically use the active venv.
Can you please double check if the Labels application is indeed using the right venv, because in the error message it seems to pick up imfusion/__init__.py from C:\Program Files. Is that your venv?
If not, try launching Labels from cmd after activating your venv.
It seems to be using the correct venv. I’ve also launched Labels from CMD with the venv enabled and still receive the error. Just as a sanity check, when I install ImFusion Labels from scratch, should that installation also correctly install the necessary python environment or python support always an extra step?
For anyone with some similar issue and older ImFusion Suite/Labels installs:
Check that the PYTHONPATH environment variable is not pointing to the Suite install.
Removing the PYTHONPATH variable solved the issue.