Upgrade your OctoPrint install to Python 3!

So @dmyers7, the issue is that you need Python 3.6 or greater to run OctoPrint, but OctoPi 0.15 doesn't have that installed at the system level. I did try to update the python version in testing, but it didn't go well - broke more things than it fixed, and some research later found that it is not recommended at all, by many people. System instability etc. etc.

Most users are running OctoPi 0.17, according to the anonymous usage tracking, so it is worthwhile having this script.

The recommended route to upgrade, can be found at the link below:

Basically, it comes down to backup your OctoPrint install using the built in function, then flash OctoPi 0.17, restore backup then use script.

1 Like

Excellent. Thank you. Easier than I thought. Something for the weekend :slight_smile:

1 Like

@jaymcd In case you didn't get notified of my reply, you can see it here:

Very easy, worked great! Thanks!

1 Like

@jddj Thank you for the feedback! I like knowing people have used it :smile:

Heads up!: If you have the plugin OctoLapse installed, it writes a stack trace as it is being loaded, so the script can read the plugin files etc. etc.

Do not worry about this, the installation will succeed, the backup still continues successfully.

You can see the issue ticket here

Hi all,

i run the script and it works for my main instance...but i have a second one and the server is down...i reverted...

Any solution for the second instance to work please?

Thanks

What we have to do for who have two instance on Octoprint, for two printers. I did install on the first one and on second instance the system ask me me to do the same upgrade ? did i have to do for all instance ?

Besides Octoprint, I do run Klipper on my Octopi and don't want to revert to Marlin. The main branch of Klipper is not yet ready for Python 3, so I guess I can't upgrade. Or am I missing something?

Hey, a script that works the first time and didn't require me to Google something to get it to work, nice!
Ran on my custom setup of OctoPrint on Raspberry Pi OS, and everything worked as it should.

One point of feedback: It doesn't say what the default config directory is, like it does for the OctoPrint env and service commands, but it wasn't too difficult to figure out.

1 Like

So, decided to give it a try on my one box. I now continue to get "Not an OctoPrint backup, lacks metadata.json" when I go to restore the setup even though the ZIP file clearly contains that file. Fails whether I upload directly through an SFTP connection or through the OctoPrint interface. Create a backup of the raw system and that restores fine as long as I don't download it first and then try and restore it. Not sure what is failing but now I get to rebuild that Pi with my configuration. So to others, be careful if you chase this also.

Hi @Oli_vier

Could you open a new 'Get Help' topic with the information requested (logs etc.). Thanks!

Hi @FullReg

You would have to do it for each instance you run.

If you are on OctoPi, use the -c flag, so that you can enter the details of where your 2nd install is located.

More :point_right: https://github.com/cp2004/Octoprint-Upgrade-To-Py3#command-line-options

1 Like

Hey @Detlev_Rackow!
Your Klipper install will not be affected unless it is in the same virtual environment (Which it shouldn't....) . However, if you are using the Klipper Plugin, someone mentioned it was not Py3 compatible.

Hey guys can you help me with this error that I'm getting:

Detecting system info...
OctoPi version: 0.17.0
Getting OctoPrint version...
OctoPrint version: 1.4.2
Reading installed plugins...
No handlers could be found for logger "octoprint.plugin.core"
Traceback (most recent call last):
  File "upgrade.py", line 555, in <module>
    plugin_keys = read_plugins_from_backup(backup_location)
  File "upgrade.py", line 362, in read_plugins_from_backup
    with zipfile.ZipFile(backup_path, 'r') as zip_ref:
  File "/usr/lib/python3.7/zipfile.py", line 1204, in __init__
    self.fp = io.open(file, filemode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/.octoprint/data/backup/octoprint-backup-20200910-205803.zip'

Seems like something has gone wrong with the backup of that install.

Could you try running ~/oprint/bin/octoprint plugins backup:backup --exclude timelapses --exclude uploads, and see if an error is generated there.

@dmyers7 - you might want to open a new topic, in 'Get Help' as the backup really should work.

To reply to myself. I have Windows running in Parallels and decided to use MS Edge to pull a copy of a similar backup from another OctoPi instance, .... restored that to the refreshed box and it works..... Something in Safari and FireFox on a Mac I suppose. That will be a good enough workaround for me, but weird in general. I can start another thread to have that looked at.

1 Like

Hey folks, just mentioning this in case it helps other newbies. I didn't realize that the instance of Python that's used by OctoPrint is separate from the one that's used by Raspberry Pi OS.
You can see the OctoPrint Python version number by scrolling to the bottom of the OctoPrint web page.
Kudos to @Charlie_Powell for setting me straight on this.

1 Like

worked flawless besides the known bed leveler plugin, which also compiled single core for over 15min to tell me, it is not working properly afterwards. ;D

1 Like