OctoPrint 1.8.0 will require Python 3
I was hoping to be able to push this off a bit further, to give more of you time to migrate, however lately the amount of work needed to keep OctoPrint running under Python 2 – which now has been declared end-of-life for two full years – has increased to ridiculous amounts.
Dependencies are dropping support left and right, compatibility workarounds in the code take up precious development and naturally also computational resources, whereas modern language features that would allow for speedier and more solid programming are out of reach. At this point, one can say that keeping OctoPrint compatible to Python 2 is actively hindering the project’s progress and stealing precious development time that would be better spent on bugfixes, features and desperately needed architectural changes.
As a very recent example of this, the release of 1.7.3 wouldn’t have been necessary to get rushed out of the door if it hadn’t been for Python 2, as a dependency dropped Python 2 support over night and forced my hand to push out a release pinning that dependency to a prior version that still had support. This isn’t the first time this has happened and it surely won’t be the last either – in fact I only expect this to increase in frequency now.
So, two years after Python 2’s EOL date of January 1st 2020, I’ve made the decision to drop Python 2 support and switch fully to Python 3 with OctoPrint 1.8.0. I would have loved to be able to wait until OctoPrint 2.0.0, but progress on this has been slower than hoped (also in part due to the overhead imposed by maintaining Python 2 compatibility on 1.x versions) and I can no longer justify the time that’s being spent on maintaining compatibility with an officially unmaintained version of Python.
According to the latest tracking data, a bit over 75% of all of you are already on Python 3, either thanks to being on a stable OctoPi 0.18 release (which shipped with Python 3) or after upgrading your install to Python 3, e.g. through Charlie’s upgrade script (which has been available since September 2020). For you absolutely nothing will change.
For the other 25% of you who still are sticking to Python 2, you will now have to either upgrade to Python 3 or be left behind on OctoPrint 1.7.x. Two years after EOL it simply is time to move forward and put Python 2 to bed. Switching to Python 3 is not only something that helps me in development, but it will also improve your OctoPrint experience, as OctoPrint’s performance under Python 3 is noticeably better. Additionally, a lot of plugins out there are already Python 3 only. So please, switch over now, you won’t regret it.
As to Python 2 compatible OctoPrint 1.7.x, the plan is to keep it around in form of a legacy repository that the update notifications for Python 2 instances out there will also be redirected to, so should there be a desperate need for an emergency security fix or something like this in the future, the option will still be there. But rest assured that that will only be done in an absolute emergency, e.g. something that puts people’s instances at a severe risk of being compromised. There will no longer be regular bug fixes or features. Those you will only get by switching to Python 3 and following the project’s future releases.
If you are unsure on what Python version your OctoPrint instance is running, you can check in the lower left corner of OctoPrint’s web interface, where it will tell you OctoPrint’s version as well as the version of Python you are running and – if you are running on OctoPi – also the version of OctoPi.
I’m sorry that I had to make this decision earlier than I had planned, but at this point it simply is no longer feasible to wait for OctoPrint 2.0.0. I’m sure that in the long run this is the best decision for the project’s well-being and also it’s continued progress.
How to upgrade to use Python 3?
If you haven’t already upgraded, then please follow the instructions set out in the Upgrade your OctoPrint install to Python 3 post on the forums. It contains steps to upgrade for all the most popular methods of installing OctoPrint.
- 31 Jan 2022