Python Upgrade Clarification

What is the problem?

Need to clarify the python upgrade process using Octopi .17

What did you already try to solve it?

I have read the guidance out there on how to use the upgrade script but I am "newer" to linux and using these scripts. It is my understanding that I can do an "in place" upgrade to python using this script. I am not clear if I need to download python first and then install or if the script does it for me. If I need to download it first can someone assist with the way to do that?

Have you tried running in safe mode?

N/A

Did running in safe mode solve the problem?

N/A

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)

octoprint-systeminfo-20211013031248.zip (13.8 KB)

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

Ocotoprint 1.7, OctoPI .17, Ender 5 Plus

OctoPi 0.17 already has Python 3 installed, OctoPrint is just not using it, which is what the script is for.

So you should be fine to follow the usage instructions and just running the script.

1 Like

Thank you very much!

Everything seemed to be going well until this:

Checking package list for python3-dev
Installing python3-dev...
[sudo] password for pi:
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/p/python3.7/libpython3.7-dev_3.7.3-2_armhf.deb 404 Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/p/python3.7/python3.7-dev_3.7.3-2_armhf.deb 404 Not Found [IP: 93.93.128.193 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
ERROR: failed to install python3-dev
Please try manually
Checking package list for python3-dev
Installing python3-dev...
[sudo] password for pi:
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/p/python3.7/libpython3.7-dev_3.7.3-2_armhf.deb 404 Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/p/python3.7/python3.7-dev_3.7.3-2_armhf.deb 404 Not Found [IP: 93.93.128.193 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
ERROR: failed to install python3-dev

Run sudo apt update first, I'm in the process of adding this step into the script - some of the repositories have recently changed locations...

If that fails, you might need to run sudo apt update --allow-releaseinfo-change as well, then all should be good.

@Charlie_Powell would it maybe make sense to add --allow-releaseinfo-change right from the get go to that sudo apt update call in your script? I see a lot more people running into this particular problem thanks to the release switcheroo shenanigans in Raspbian.

I've prepped the change (see commit here) to run sudo apt-get update --allow-releaseinfo-change - I realised that somewhere along the line I forgot to add sudo apt-get update in there completely, though I'm sure it was there at some point.

I haven't yet had a chance to test it, and I'm not going to push the change without a few test runs first with so much traffic to the script at the moment... Going to do it (hopefully) this evening.

1 Like

This worked on my two older pi images and updated them correctly. Stupid question but one of my instances has Octopi .18 vs .17. How to do get that to update. It says it is using Python 2 still from the pop-up in Octo-print.

OctoPi 0.18 shipped with Python 3, so unless something went terribly wrong there, it's running under Python 3 already. Could you maybe have mixed up instances? I definitely restricted the popup to Python 2 and cannot see it under my own Python 3 instances.

I will attach the system info but I did confirm that it is Octopi.18 and I get the pop-up.
octoprint-systeminfo-20211013171228.zip (14.7 KB)

It shows it running the older python still despite being Ocotpi .18.

Could it be that this is a very early 0.18 flashed from a nightly image a long long time ago? Or did you modify it in any way since flashing? Because it certainly should not be shipping with Python 2.7. This is from a fresh OctoPi 0.18:
octoprint-systeminfo-20211013171855.zip (786.8 KB)

To quote:

env.python.version : 3.7.3

Yeah the only 0.18-versioned images that shipped with Python 2 were early nightly builds. I've campaigned for a nightly version tag (like 0.18-nightly) to tell the difference before but got rejected...

This was a image I had downloaded from TH3D awhile ago. I had not modified it at all. Am I able to update this somehow without reimaging it?

You should be able to use the script to upgrade that image as well, as it is basically 0.17 with a different version number.

https://github.com/cp2004/Octoprint-Upgrade-To-Py3 has the details on that, but I think you've already used that on one of them - so you should be able to do the same thing again. I know it says 0.17 only, but it should allow 0.18 as well because of corner-cases like this.

Thanks Again. I did try running it previously but for some reason it did not work. I tried running it again and it worked. Thanks to both of you for your assistance!