Octoprint 1.8.6 startup fails on Python 3.11 re formatargspec

octoprint Version 1.8.6 is not yet compatible with python 3.11 and fails on startup

  • ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)

A quick web search yielded:

  • DeprecationWarning: formatargspec is deprecated since Python 3.5. Use signature and the Signature object directly

Fedora 37 just shipped with python 3.11 as the default implementation. I was able to install python 3.10 in parallel with the new version and get my octoprint running again.

octoprint-systeminfo-20221116145152.zip (17.9 KB)

Python 3.11 is still not supported by OctoPrint.

Also see this:

From the readme, OctoPrint is not compatible with 3.11. The next version, 1.9.0 has all of the required fixes in it to work on 3.11. Since 3.11 was only released a few weeks ago you will have to wait for compatibility to be added.

GitHub - OctoPrint/OctoPrint: OctoPrint is the snappy web interface for your 3D printer!

1 Like

Glad to hear 1.9 is already planning to support python 3.11 . I am running fine with 3.10 on Fedora 37, but wanted to report the issue.

It's no issue...

I know it's hard and not very practical to do this at a later point (since you cannot retroactively add this to already published versions), but the python_requires metadata should usually be set to something more specific than >=3.7, <4 if e.g. 3.11 isn't supported...

That's a decent idea and what is going to be done going forwards - I guess I personally hoped that a new minor release could just be supported, but for all of 3.9, 3.10 and 3.11 there's been incompatibilities. In OctoPrint 1.9.0 the upper bound has been set more specifically.

Python is quite generous w/ deprecation periods until things get removed. But it's really important to run either CI or even development with deprecation warnings enabled - that way you'll be warned 1-3 years in advance (I don't remember how long and am too lazy to search ;))

For this particular issue: Python 3.5 (which deprecated formatargspec in the docs) was released in 2015, and 3.7 (released in 2018) started showing a DeprecationWarning when calling formatargspec. And only late this year - 4 years after the DeprecationWarning - was the code actually removed.

Any update on Python 3.11 support?

I'm keen to see if the performance improvements over 3.10 make a noticeable difference on ARM devices such as the Rock PI.

1 Like

Ohhh I didn't even think to look for a GitHub issue for it! Thanks, I'll follow that issue for updates.