Upgrade your OctoPrint install to Python 3!

I ran both of the commands as root.
It says that there were some error messages though...

Detecting system info...
OctoPi version: 0.17.0
Getting OctoPrint version...
OctoPrint version: 1.4.2
Reading installed plugins...
2020-09-10 18:06:56,358 - octolapse.init - INFO - Release mode detected.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.7/logging/init.py", line 1676, in shutdown
h.close()
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/logging/handlers.py", line 32, in close
self._executor.shutdown(wait=True)
AttributeError: 'OctolapseConsoleHandler' object has no attribute '_executor'
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.7/logging/init.py", line 1676, in shutdown
h.close()
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/logging/handlers.py", line 32, in close
self._executor.shutdown(wait=True)
AttributeError: 'OctolapseConsoleHandler' object has no attribute '_executor'
Traceback (most recent call last):
File "upgrade.py", line 556, in
plugin_keys = read_plugins_from_backup(backup_location)
File "upgrade.py", line 363, 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-180656.zip'

0.17 has been out since November of 2019. Almost a year

2 Likes

thanks, i will try this evening :wink:

1 Like

I got this too - you need to run it as the pi user, not as root...

1 Like

I'm an active user of Octopi but no longer a techie. Would it not be possible to include this conversion in the next update?

Good morning,

i just upgraded my Octopi to Python 3 but then realized some addons I wanted to use aren't compatible.
Then I wanted to revert my installation with the downgrade script and now I'm left with no OctoPrint Version:

OctoPrint version : unknown
OctoPi version : 0.17.0

Can anyone help me with this one? I don't fancy to reinstall my whole raspberry....

When I try to rerun the upgrade script:

pi@octopi:~ $ python3 upgrade.py
OctoPrint Upgrade to Py 3 (v2.0.4)

Hello!
This script will move your existing OctoPrint configuration from Python 2 to Python 3
This script requires an internet connection and it will disrupt any ongoing print jobs.

It will install the latest version of OctoPrint (1.4.2) and all plugins.
No configuration or other files will be overwritten

Press [enter] to continue or ctrl-c to quit

Detecting system info...
OctoPi version: 0.17.0
Hmm, seems like you don't have an environment at /home/pi/oprint

@quintz Could you open a new 'Get help' topic so I can talk it through later today, since it gets confusing with multiple conversations here.

@bbc0 - The next version of OctoPi is going to be Python 3 default (0.18). The script is easy to use, even for someone who's not a 'techie'!

@Muldoon - do NOT run the commands as root, since it messes with the permissions.
The first error, you can ignore (Made by OctoLapse not playing nice with reading the plugins), the second is because it is run as root.

thanks a lot for this hint!

1 Like

Sorry, I use Octopi and I use Klipper, but I don't know much about Python. I installed Octopi 017 on my Raspi 3B, and I installed Klipper in the official way, meaning a git pull and then starting the installation script. I don't know if this creates a seperate virtual environment. Updating Klipper works similar: The official way is to do a git pull, then restart the service. In some cases, a new MCU-firmware is an additional step.

As the functionality of Klipper is critical for my printer, I will wait until there is a clear statement from the Klipper developers.

Best,

Detlev

I've got a little issue on display. Installed on a Raspberry Pi 3B.

Resources don't update (cf screenshot). Resource Monitor Tab updates correctly.

Is there a way to know which plugins aren't supporitng python3 before updating?

@derekpurdy, Yes, there are a couple of ways. If you are running OctoPrint 1.4.2, then the Plugin Manager will show you directly. For 1.4.2 and earlier versions, you can install the plugin Python 3 Check by @jneilliii using the Plugin Manager.

Its homepage is https://github.com/jneilliii/OctoPrint-Python3PluginCompatibilityCheck.

1 Like

Thanks![quote="b-morgan, post:47, topic:23973, full:true"]
@derekpurdy, Yes, there are a couple of ways. If you are running OctoPrint 1.4.2, then the Plugin Manager will show you directly. For 1.4.2 and earlier versions, you can install the plugin Python 3 Check by @jneilliii using the Plugin Manager.

Its homepage is https://github.com/jneilliii/OctoPrint-Python3PluginCompatibilityCheck.
[/quote]

Thanks so much! I see I have a couple, but they aren't so important.

Worked perfectly for me, Thanks!!! OctoPi 0.17.0 / OctoPrint 1.4.2 / Python 3.7.3

1 Like

Hey @Detlev_Rackow
I just had a look at Klipper, and it doesn't run in Python at all. What you may be thinking of is the plugin for OctoPrint for a better (than already functional) integration.

In the coming days the Klipper plugin is being adopted, with the new version already compatible. Once that happens, then you should have no issue upgrading to Python 3.

@coubi64 - that looks like an issue with the specific plugin, (Dashboard) since Resource Monitor updates correctly, whatever is wrong in Dashboard should be reported to the plugin author so they can take a look.

If it is in the next release, I may as well wait for that unless there is an urgent need.

(I am biased) but would it not be fun to have Python 3.7 in the bottom corner of your web interface now. There's also some performance improvements....

I’m sure @jneilliii could have written a plugin in minutes that replaces the text Python 2.7 with Python 3.7 in the UI :wink:

1 Like

now that's funny.

1 Like

True but off-topic story: the very first plugin I published for Cura pretended to offer a way to switch off automatic slicing after making changes. All it did was place a white rectangle over the slicing progress bar so you would not see the slicing taking place. I got actual users telling me how much it sped up Cura. (Since then the plugin has been rewritten to actually do what it promised)

1 Like