opentrons: bug: python3.11 coroutine dependency broke

Overview

opentrons_simulate on python3.11 does not work due to coroutines being updated.

Steps to reproduce

  • Install python3.11
  • Install opentrons (pip install opentrons)
  • Run opentrons_simulate

Current behavior

[koeng@nuci3 pcr_bottleneck]$ opentrons_simulate Traceback (most recent call last): File “/home/koeng/.local/bin/opentrons_simulate”, line 5, in <module> from opentrons.simulate import main File “/home/koeng/.local/lib/python3.11/site-packages/opentrons/init.py”, line 11, in <module> from opentrons.hardware_control import ( File “/home/koeng/.local/lib/python3.11/site-packages/opentrons/hardware_control/init.py”, line 14, in <module> from .api import API File “/home/koeng/.local/lib/python3.11/site-packages/opentrons/hardware_control/api.py”, line 33, in <module> from .backends import Controller, Simulator File “/home/koeng/.local/lib/python3.11/site-packages/opentrons/hardware_control/backends/init.py”, line 1, in <module> from .controller import Controller File “/home/koeng/.local/lib/python3.11/site-packages/opentrons/hardware_control/backends/controller.py”, line 20, in <module> import aionotify # type: ignore[import] ^^^^^^^^^^^^^^^^ File “/home/koeng/.local/lib/python3.11/site-packages/aionotify/init.py”, line 5, in <module> from .base import Watcher File “/home/koeng/.local/lib/python3.11/site-packages/aionotify/base.py”, line 10, in <module> from . import aioutils File “/home/koeng/.local/lib/python3.11/site-packages/aionotify/aioutils.py”, line 122, in <module> @asyncio.coroutine ^^^^^^^^^^^^^^^^^ AttributeError: module ‘asyncio’ has no attribute ‘coroutine’. Did you mean: ‘coroutines’?

Expected behavior

Dependencies should be updated.

Operating system

Linux

System and robot setup or anything else?

No response

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 17 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks @Koeng101, this is on our radar internally, too. For Opentrons folks, please see RSS-172

Has this been on the radar for over a year?

Python 3.11 is released a long time ago, it would be great to see a support for it. Currently this issue is a blocker for us to upgrade our application to Python 3.11. Unfortunately aionotify seems like an abandoned package, last commit was on Oct 17, 2018.

On our end, we’ve paired up robot control with many other of our internal systems and database in order to track errors, easily transfer complicated protocol information back and forth, etc, and so I would need to build pyenv into a complicated existing system. I write a lot of code, but I’m a biologist with very little formal programming training–I can definitely figure out how to make it work, but it would take me a few days to work out all the kinks. HTTP API looks really cool and useful, but is not at all integrated with our current system. Obviously I could use it, but again, this would take me several days of work, including learning the first thing about HTTP, which I currently know next to nothing about. Multiple days of work is a LOT for a bug that should be pretty easily fixed, or even just patched so opentrons can at least be imported on 3.11 without immediately breaking. And sure, if it was just me, I’d figure it out. But clearly there are a bunch of people here who are spending large chunks of their time trying to solve this issue for themselves–which is not that surprising to me, since the website documentation has a whole section designed for mid-level users recommending the use of opentrons_simulate despite needing a really annoying workaround to function. It could get fixed once now, or repeatedly cause customers relatively new to coding hours of work.

Hi!

There is a workaround.

You can leverage a tool like Pyenv to switch Python versions, or delete 3.11.0 from your computer, install an earlier Python version like 3.10.0 and it should work!

Sorry, this is a bit of a tricky workaround. If you go into Support’s queue we’ll be able to provide a bit more specific back and forth.

image

I contacted Opentrons and was told I must downgrade Python for it to work. They linked this bug ticket from January 2022, which hilariously is flagged as “closed” with the “solution” of simply downgrading python versions. I guess they don’t plan on ever fixing this.

https://github.com/Opentrons/opentrons/issues/9331

Doesn’t seem to be. Also, to be clear (for the Opentrons folks), it’s not just running opentrons_simulate that this breaks, which would be annoying but not that big of a deal–we’ve been trying to interface with multiple robots through one computer, and we can’t import opentrons properly, so in order to get data off any robot, we have to write to text files and pass them back and forth, which takes much longer (up to several minutes instead of seconds) and is more computationally intensive and prone to errors. A long-term solution to this would be much appreciated.

Hi there, Is there any hope to have your software supporting the latest official python version soon? And mention on the front page which highest version is OK (3.10 apparently in my case)

to help others having the same issue and willing to work with conda, here is my success on a M2 macbook pro

conda update -n base -c defaults conda
conda create -n opentrons python=3.10
conda activate opentrons
pip install opentrons
opentrons_simulate -h

Opened a PR: https://github.com/rbarrois/aionotify/pull/19.

In the meantime, my fork (https://github.com/rickwierenga/aionotify) passes the tests. You should be able to use that to test this repo.