Open
Description
- psygnal version: latest 0.11.1
- Python version: 3.10
- Operating System: Mac OS (ARM64), Raspberry Pi OS (ARM), Ubuntu 24.10 (x86); all in docker
Issue Description:
There seems to be a platform-specific behavior with psygnal on x86 vs ARM architectures. The problem occurs when attempting to subclass a psygnal object after integrating websockets in the ImSwitch project. The error only appears on x86 (such as on a Kubernetes Cluster) but works fine on ARM64 platforms like Raspberry Pi and MacOS, presumably because the compiled psygnal binary is installed differently between architectures.
Stack trace:
Starting Imswitch with the following parameters:
--headless --no-ssl --http-port 8001 --config-folder None --config-file example_virtual_microscope.json --ext-data-folder None
ERROR:root:Traceback (most recent call last):
File "/tmp/ImSwitch/imswitch/__main__.py", line 79, in main
from imswitch.imcommon import prepareApp, launchApp
File "/tmp/ImSwitch/imswitch/imcommon/__init__.py", line 1, in <module>
from .applaunch import prepareApp, launchApp
File "/tmp/ImSwitch/imswitch/imcommon/applaunch.py", line 6, in <module>
from .model import dirtools, pythontools, initLogger
File "/tmp/ImSwitch/imswitch/imcommon/model/__init__.py", line 1, in <module>
from .SharedAttributes import SharedAttributes
File "/tmp/ImSwitch/imswitch/imcommon/model/SharedAttributes.py", line 3, in <module>
from imswitch.imcommon.framework import Signal, SignalInterface
File "/tmp/ImSwitch/imswitch/imcommon/framework/__init__.py", line 4, in <module>
from .noqt import *
File "/tmp/ImSwitch/imswitch/imcommon/framework/noqt.py", line 151, in <module>
class Thread(abstract.Thread):
File "/tmp/ImSwitch/imswitch/imcommon/framework/noqt.py", line 153, in Thread
_started = Signal()
TypeError: interpreted classes cannot inherit from compiled
Steps to Reproduce:
- Run the code on an x86 platform (e.g., a Kubernetes Cluster).
- Use the socket integration in the ImSwitch project where subclassing a psygnal object is involved.
- Observe the above error on x86.
Links:
- Working version
- Version with socket integration
- Debugging info: https://github.com/pyapp-kit/psygnal?tab=readme-ov-file#debugging
Additional Context:
- This issue does not appear on ARM64 platforms, likely because the psygnal compiled binaries are not installed there, allowing subclassing to work.
- A workaround may involve using
pip install --no-binary psygnal
, but this has not been tested fully yet.
Possible Solution:
- It might be necessary to add additional wheels to psygnal to support x86/arm specifically, or ensure the decompiled version is used where subclassing is needed. For this I was trying to add the
zip
-Archive to thesetup.py
so that it will compile it from scratch when installing imswitch.
Thanks to @tlambert03 for the insights into the issue - and I hope I didn't for get anything. Not sure how I can explain the issue any better or give better code snippets.
Metadata
Metadata
Assignees
Labels
No labels