new version of websockets causes web server to not start

Posted on
Mon Apr 03, 2023 5:28 am
MartyS offline
Posts: 86
Joined: May 06, 2008
Location: Charlotte, North Carolina

new version of websockets causes web server to not start

I just happened to upgrade Indigo from 2022.1 to 2022.2 on April 2nd. The same day that the module websockets for Python 3.10 got updated to a new major version: 11.0. This results in the Indigo Web Server failing to start… which means no Indigo Touch and no Reflector connection. The errors in the Indigo log are as follows:

Code: Select all
2023-04-02 18:23:41.590   Web Server Error   Error in plugin execution InitializeMain:

  File "plugin.py", line 3, in init plugin
  File "plugin.py", line 21, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sanic/__init__.py", line 2, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sanic/app.py", line 73, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sanic/mixins/runner.py", line 51, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sanic/server/protocols/websocket_protocol.py", line 3, in <module>
type: cannot import name 'CLOSED' from 'websockets.connection' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websockets/connection.py)
2023-04-02 18:23:41.591   Application   Stopping plugin "Web Server 2022.2.0" (pid 7776)
2023-04-02 18:23:42.239   Application   Stopped plugin "Web Server 2022.2.0"

Based on this Stack Overflow article, a workaround was to downgrade websockets to version 10.n, the version before 11.0. This was accomplished via this command:

Code: Select all
sudo -H /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -m pip install --upgrade --force-reinstall websockets==10.4

Once I did this I was able to stop/start the Indigo Server and its web server resumed operation successfully. Hurray! :D

I think this issue is going to bite anyone else upgrading or installing Indigo at this point in time, since the latest version of websockets will be installed automatically. Similarly, if someone upgrades websockets for other applications and/or projects it would then impact Indigo's server behavior the next time it is launched on that system.

Here's the changelog for websockets in case that helps.

/Marty

Posted on
Mon Apr 03, 2023 5:54 am
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: new version of websockets causes web server to not start

Glad to hear that you found a solution to get back to normal.

MartyS wrote:
I think this issue is going to bite anyone else upgrading or installing Indigo at this point in time, since the latest version of websockets will be installed automatically. Similarly, if someone upgrades websockets for other applications and/or projects it would then impact Indigo's server behavior the next time it is launched on that system.


Do you think that websockets was updated to v11.0 as a part of the Indigo upgrade process by the Indigo installer?

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Apr 03, 2023 6:01 am
MartyS offline
Posts: 86
Joined: May 06, 2008
Location: Charlotte, North Carolina

Re: new version of websockets causes web server to not start

Do you think that websockets was updated to v11.0 as a part of the Indigo upgrade process by the Indigo installer?

Given that the timestamps on the files matched my Indigo upgrade time, yes I do.
Code: Select all
marty ~ % ls -la /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websockets/
total 480
drwxr-xr-x   28 root  admin    896 Apr  2 17:53 .
drwxrwxr-x  352 root  admin  11264 Apr  2 17:53 ..
-rw-r--r--    1 root  admin   3426 Apr  2 17:53 __init__.py
-rw-r--r--    1 root  admin   4744 Apr  2 17:53 __main__.py
drwxr-xr-x   21 root  admin    672 Apr  2 17:53 __pycache__
-rw-r--r--    1 root  admin    139 Apr  2 17:53 auth.py
-rw-r--r--    1 root  admin  12418 Apr  2 17:53 client.py
-rw-r--r--    1 root  admin    333 Apr  2 17:53 connection.py
-rw-r--r--    1 root  admin   5738 Apr  2 17:53 datastructures.py
-rw-r--r--    1 root  admin  10143 Apr  2 17:53 exceptions.py
drwxr-xr-x    6 root  admin    192 Apr  2 17:53 extensions
-rw-r--r--    1 root  admin  12537 Apr  2 17:53 frames.py
-rw-r--r--    1 root  admin  16120 Apr  2 17:53 headers.py
-rw-r--r--    1 root  admin    644 Apr  2 17:53 http.py
-rw-r--r--    1 root  admin  12565 Apr  2 17:53 http11.py
-rw-r--r--    1 root  admin   2790 Apr  2 17:53 imports.py
drwxr-xr-x   13 root  admin    416 Apr  2 17:53 legacy
-rw-r--r--    1 root  admin  23822 Apr  2 17:53 protocol.py
-rw-r--r--    1 root  admin      0 Apr  2 17:53 py.typed
-rw-r--r--    1 root  admin  20857 Apr  2 17:53 server.py
-rw-r--r--    1 root  admin   5834 Apr  2 17:53 speedups.c
-rwxr-xr-x    1 root  admin  51435 Apr  2 17:53 speedups.cpython-310-darwin.so
-rw-r--r--    1 root  admin   4038 Apr  2 17:53 streams.py
drwxr-xr-x   10 root  admin    320 Apr  2 17:53 sync
-rw-r--r--    1 root  admin   1384 Apr  2 17:53 typing.py
-rw-r--r--    1 root  admin   3215 Apr  2 17:53 uri.py
-rw-r--r--    1 root  admin   1150 Apr  2 17:53 utils.py
-rw-r--r--    1 root  admin   2721 Apr  2 17:53 version.py

/Marty

Posted on
Mon Apr 03, 2023 9:57 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: new version of websockets causes web server to not start

Thanks for the troubleshooting, Marty. You are correct and we'll be releasing a bug fix version ASAP that forces websocket to version 10.4. In the mean time your Terminal command line is a good workaround:

Code: Select all
sudo -H /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -m pip install --upgrade --force-reinstall websockets==10.4

Image

Posted on
Wed Apr 05, 2023 8:41 am
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: new version of websockets causes web server to not start

Indigo 2022.2.1 fixes this issue by explicitly installing websockets v10.4.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 36 guests