labscript-suite installation issues

119 views
Skip to first unread message

Matthew Peters

unread,
Feb 7, 2023, 9:41:52 AM2/7/23
to the labscript suite
Hi all,

When I install labscript-suite ("pip install labscript-suite") and attempt to run runmanager or blacs, I get the following error (see below). I've attempted to install tornado 6.2, but I get another error. It seems like this issue has arisen within the past couple of weeks because when I recently installed labscript on a another computer I had no issue. Does anyone have any suggestions on how to fix this?

Thanks,
Matthew

Error below:
(Python310) C:\Users\Lab_Computer\Python310\Scripts>runmanager
2023-02-07 09:35:30,778 INFO runmanager:

===============starting===============

2023-02-07 09:35:30,818 ERROR runmanager: Got an exception:
Traceback (most recent call last):
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zprocess\security.py", line 349, in instance
    return cls._instances[cls, shared_secret]
  File "C:\Program Files\Python310\lib\weakref.py", line 137, in __getitem__
    o = self.data[key]()
KeyError: (<class 'labscript_utils.ls_zprocess.Context'>, 'UPHYSrNufJtuKTPmjJ45rPt0nkGAmGG1KuCKgWpOA/DdcLrBe8mbxpWDsAa8zKRFa5oAGKRN8eUT078L6BsuDQ==')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\runmanager\__main__.py", line 3706, in <module>
    app = RunManager()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\runmanager\__main__.py", line 1375, in __init__
    self.output_box = OutputBox(self.ui.verticalLayout_output_tab)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\labscript_utils\qtwidgets\outputbox.py", line 23, in __init__
    context = Context.instance()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\labscript_utils\ls_zprocess.py", line 249, in instance
    return super(Context, cls).instance(shared_secret=config['shared_secret'])
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zprocess\security.py", line 351, in instance
    instance = cls(io_threads, shared_secret=shared_secret)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\labscript_utils\ls_zprocess.py", line 241, in __init__
    SecureContext.__init__(
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zprocess\security.py", line 335, in __init__
    auth.start()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\auth\thread.py", line 107, in start
    super().start()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\auth\base.py", line 82, in start
    self.zap_socket = self.context.socket(zmq.REP, socket_class=zmq.Socket)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\labscript_utils\ls_zprocess.py", line 254, in socket
    return SecureContext.socket(self, *args, **kwargs)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\sugar\context.py", line 361, in socket
    s: ST = socket_class(  # set PYTHONTRACEMALLOC=2 to get the calling frame
TypeError: Socket.__init__() got an unexpected keyword argument 'allow_insecure'

Traceback (most recent call last):
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zprocess\security.py", line 349, in instance
    return cls._instances[cls, shared_secret]
  File "C:\Program Files\Python310\lib\weakref.py", line 137, in __getitem__
    o = self.data[key]()
KeyError: (<class 'labscript_utils.ls_zprocess.Context'>, 'UPHYSrNufJtuKTPmjJ45rPt0nkGAmGG1KuCKgWpOA/DdcLrBe8mbxpWDsAa8zKRFa5oAGKRN8eUT078L6BsuDQ==')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\runmanager\__main__.py", line 3706, in <module>
    app = RunManager()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\runmanager\__main__.py", line 1375, in __init__
    self.output_box = OutputBox(self.ui.verticalLayout_output_tab)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\labscript_utils\qtwidgets\outputbox.py", line 23, in __init__
    context = Context.instance()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\labscript_utils\ls_zprocess.py", line 249, in instance
    return super(Context, cls).instance(shared_secret=config['shared_secret'])
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zprocess\security.py", line 351, in instance
    instance = cls(io_threads, shared_secret=shared_secret)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\labscript_utils\ls_zprocess.py", line 241, in __init__
    SecureContext.__init__(
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zprocess\security.py", line 335, in __init__
    auth.start()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\auth\thread.py", line 107, in start
    super().start()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\auth\base.py", line 82, in start
Exception in thread Thread-1:
Traceback (most recent call last):
    self.zap_socket = self.context.socket(zmq.REP, socket_class=zmq.Socket)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\asyncio.py", line 49, in _get_selector_windows
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\labscript_utils\ls_zprocess.py", line 254, in socket
    from tornado.platform.asyncio import AddThreadSelectorEventLoop
    return SecureContext.socket(self, *args, **kwargs)
ImportError: cannot import name 'AddThreadSelectorEventLoop' from 'tornado.platform.asyncio' (C:\Users\Lab_Computer\Python310\lib\site-packages\tornado\platform\asyncio.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\sugar\context.py", line 361, in socket
  File "C:\Program Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
    s: ST = socket_class(  # set PYTHONTRACEMALLOC=2 to get the calling frame
TypeError: Socket.__init__() got an unexpected keyword argument 'allow_insecure'
    self.run()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\auth\thread.py", line 47, in run
    loop.run_until_complete(self._run())
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\auth\thread.py", line 62, in _run
    events = dict(await self.poller.poll())
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\_future.py", line 128, in poll
    socket._add_recv_event('poll', future=watcher)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\_future.py", line 493, in _add_recv_event
    self._add_io_state(POLLIN)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\_future.py", line 666, in _add_io_state
    self._update_handler(self._state)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\_future.py", line 682, in _update_handler
    self._get_loop()
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\_future.py", line 62, in _get_loop
    self._init_io_state(self._current_loop)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\asyncio.py", line 147, in _init_io_state
    self._get_selector(io_loop).add_reader(
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\asyncio.py", line 143, in _get_selector
    return _get_selector(io_loop)
  File "C:\Users\Lab_Computer\Python310\lib\site-packages\zmq\asyncio.py", line 51, in _get_selector_windows
    raise RuntimeError(
RuntimeError: Proactor event loop does not implement add_reader family of methods required for zmq. zmq will work with proactor if tornado >= 6.1 can be found. Use `asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())` or install 'tornado>=6.1' to avoid this error.

Matthew Peters

unread,
Feb 7, 2023, 10:04:59 AM2/7/23
to the labscript suite
Just to add a bit more detail, I've tested that it seems to fail on 3 different windows computers (both Windows 10 and 11) and one of those computers has a functional labconfig that runs runmanager and blacs fine in a different environment.

dihm....@gmail.com

unread,
Feb 7, 2023, 3:11:05 PM2/7/23
to the labscript suite
This isn't likely to be the most helpful comment up front, but I seem to recall that there are some very deep-down elements of labscript that aren't properly available with python 3.10 (notably the labscript-c-extensions). I'm not quite sure what pip is doing to handle that reality and it could be the root source of these problems. Could you attempt an install forcing python=3.9?

Also, the root issue appears to be some API-like change in zprocess itself. Perhaps some incompatibility with a newer library has developed there. Could you share your environment package list for a working install and the broken install?

-David

Matthew Peters

unread,
Feb 8, 2023, 3:29:11 PM2/8/23
to the labscript suite
Hi David,

Thanks for the help. I wasn't able to get it to work with Python 3.9 either with the same error. I've posted below the packages for the broken/working environments. Let me know if there's anything else that could be helpful. (I think I might have also accidentally sent a private message instead of a public one yesterday, but the contents of this message are the same)

Matthew

Broken:
blacs==3.1.0
colorama==0.4.6
contourpy==1.0.7
cycler==0.11.0
desktop-app==0.3.0
distlib==0.3.6
fonttools==4.38.0
h5py==3.8.0
importlib-metadata==6.0.0
kiwisolver==1.4.4
labscript==3.2.0
labscript-c-extensions==1.0.2
labscript-devices==3.1.1
labscript-suite==3.1.0
labscript-utils==3.2.1
lyse==3.1.0
matplotlib==3.6.3
numpy==1.24.2
packaging==23.0
pandas==1.5.3
Pillow==9.4.0
PyDAQmx==1.4.6
pynivision==2015.0.0
pyparsing==3.0.9
PyQt5==5.15.9
PyQt5-Qt5==5.15.2
PyQt5-sip==12.11.1
pyqtgraph==0.13.1
pyserial==3.5
python-dateutil==2.8.2
pytz==2022.7.1
pytz-deprecation-shim==0.1.0.post0
PyVISA==1.13.0
pywin32==305
pyzmq==25.0.0
qtutils==3.0.0
runmanager==3.1.1
runviewer==3.1.2
scipy==1.10.0
setuptools-scm==7.1.0
six==1.16.0
spinapi==3.2.2
tomli==2.0.1
tqdm==4.64.1
typing_extensions==4.4.0
tzdata==2022.7
tzlocal==4.2
windows-curses==2.3.1
zipp==3.12.1
zprocess==2.21.0

Working:
absl-py==1.0.0
appdirs==1.4.4
ARC-Alkali-Rydberg-Calculator==3.0.21
argon2-cffi==20.1.0
asteval==0.9.25
astunparse==1.6.3
async-generator==1.10
atomicwrites==1.4.0
attrs==21.2.0
backcall==0.2.0
bcrypt==3.2.0
blacs==3.1.0
bleach==4.0.0
cachetools==4.2.4
certifi==2021.10.8
cffi==1.14.6
charset-normalizer==2.0.9
chromedriver-autoinstaller==0.3.1
colorama==0.4.4
constants==0.6.0
cryptography==37.0.4
cycler==0.10.0
debugpy==1.4.1
decorator==5.0.9
defusedxml==0.7.1
desktop-app==0.2.8
distlib==0.3.2
docopt==0.6.2
docutils==0.18.1
entrypoints==0.3
flatbuffers==2.0
future==0.18.2
futures==3.1.1
gast==0.4.0
google-auth==2.3.3
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
grpcio==1.43.0
h11==0.13.0
h5py==3.3.0
idna==3.3
importlib-metadata==4.6.1
iniconfig==1.1.1
install==1.3.5
instrument==0.6.0
ipykernel==6.0.3
ipython==7.26.0
ipython-genutils==0.2.0
ipywidgets==7.6.3
jedi==0.18.0
Jinja2==3.0.1
joblib==1.1.0
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.12
jupyter-console==6.4.0
jupyter-core==4.7.1
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.0
keras==2.7.0
Keras-Preprocessing==1.1.2
kiwisolver==1.3.1
labscript==3.2.0
labscript-c-extensions==1.0.1
labscript-devices==3.1.1
labscript-suite==3.1.0
labscript-utils==3.2.1
libclang==12.0.0
llvmlite==0.36.0
lmfit==1.0.3
lyse==3.1.0
Markdown==3.3.6
MarkupSafe==2.0.1
matplotlib==3.4.2
matplotlib-inline==0.1.2
mercurial==5.8.1
mistune==0.8.4
mpmath==1.2.1
nbclient==0.5.3
nbconvert==6.1.0
nbformat==5.1.3
nest-asyncio==1.5.1
nose==1.3.7
notebook==6.4.3
numba==0.53.1
numpy==1.21.0
oauthlib==3.1.1
opencv-python==4.5.3.56
opt-einsum==3.3.0
outcome==1.2.0
packaging==21.0
pandas==1.3.0
pandocfilters==1.4.3
paramiko==2.7.2
parso==0.8.2
path==16.4.0
pickleshare==0.7.5
Pillow==8.3.1
pipreqs==0.4.11
pluggy==1.0.0
prometheus-client==0.11.0
prompt-toolkit==3.0.19
protobuf==3.19.1
py==1.11.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
PyDAQmx==1.4.4
pyee==8.2.2
Pygments==2.9.0
PyNaCl==1.4.0
pynivision==2015.0.0
pynput==1.7.3
pyOpenSSL==22.0.0
pyparsing==2.4.7
pyppeteer==1.0.2
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.9.0
pyqtgraph==0.12.2
pyrpl==0.9.3.6
pyrsistent==0.18.0
pyserial==3.5
PySocks==1.7.1
pytest==6.2.5
python-dateutil==2.8.1
pytz==2021.1
PyVISA==1.11.3
pywin32==301
pywinpty==1.1.3
PyYAML==5.4.1
pyzmq==22.1.0
qtconsole==5.1.1
QtPy==1.9.0
qtutils==3.0.0
Quamash==0.6.1
qutip==4.6.2
requests==2.27.0
requests-oauthlib==1.3.0
rsa==4.8
runmanager==3.1.1
runviewer==3.1.2
scikit-learn==1.0.2
scipy==1.7.0
scp==0.13.6
selenium==4.3.0
Send2Trash==1.8.0
setuptools-scm==6.0.1
six==1.16.0
sniffio==1.2.0
sortedcontainers==2.4.0
spinapi==3.2.2
sympy==1.9
tensorboard==2.7.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
tensorflow==2.7.0
tensorflow-estimator==2.7.0
tensorflow-io-gcs-filesystem==0.23.1
termcolor==1.1.0
terminado==0.10.1
testpath==0.5.0
threadpoolctl==3.0.0
toml==0.10.2
tornado==6.1
tqdm==4.64.0
traitlets==5.0.5
trio==0.21.0
trio-websocket==0.9.2
typing-extensions==3.10.0.0
tzlocal==2.1
uncertainties==3.1.6
urllib3==1.26.7
wcwidth==0.2.5
webencodings==0.5.1
websockets==10.3
Werkzeug==2.0.2
widgetsnbextension==3.5.1
windfreak==0.3.0
windows-curses==2.2.0
wrapt==1.13.3
wsproto==1.1.0
yarg==0.1.9
zipp==3.5.0
zprocess==2.20.1

Chris Billington

unread,
Feb 8, 2023, 3:42:45 PM2/8/23
to labscri...@googlegroups.com
Hi Matthew,

This looks like a bug in pyzmq to me. They released a new version a few weeks ago, and it looks to be messing with our ability to use a custom Socket class.

I'll try to reproduce it and report a bug to them. In the meantime, you might try downgrading to a version of pyzmq lower than 25.0.

Regards,

Chris

--
You received this message because you are subscribed to the Google Groups "the labscript suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to labscriptsuit...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/labscriptsuite/3fafdb6b-97cb-4e57-86c9-bb445eb882dbn%40googlegroups.com.

Matthew Peters

unread,
Feb 8, 2023, 3:53:56 PM2/8/23
to the labscript suite
That solved it, thanks so much!

Chris Billington

unread,
Feb 8, 2023, 4:03:50 PM2/8/23
to labscri...@googlegroups.com
Excellent, glad to hear!

By the way, the traceback you posted in your first email contains an encryption key, this can give access to your control computer to anyone on your local network whilst labscript suite programs are running. This key is now on the public internet, so I recommend you don't use it!

You can generate a new key by running "python -m zprocess.makesecret", putting the resulting file in <labscript-suite-profile>/labconfig, and editing your labconfig file's security section to point to it. A new key is generated whenever you create a new labscript suite profile, so the above is only necessary to modify the key for an existing profile.

-Chris

Reply all
Reply to author
Forward
0 new messages