The Python 3 Check plugin will give you an up-to-date overview of incompatible plugins installed on your instance.
1 replyOctoPrint 1.4.2 also includes the compatibility information stated by the currently installed version in your plugin manager overview:
If it says "Python >=2.7, <4" (or "Python >=3") it supports Python 3, if it says "Python >=2.7, <3" it doesn't.
Awesome, thank you!
I'm getting a your running OctoPi 0.15 warning, can't proceed. I also read that you have to reflash to upgrade OctoPi, even though OctoPrint is current, which seems to indicate I have to rebuild all my Pis with there plug-ins and customizations just to upgrade Python...... Is there an easier way? (It's working now and I'm not looking to break it or spend a bunch of time to get back to working.)
Thanks in advance
1 replygetting a 'certificate not trusted unable to verify' maybe you should update your CA
I was able to run the script and switch over, the only hitch I could see is that my Bed Visualization plugin doesn't work due to an already known issue. Thanks mate!
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.
2 repliesExcellent. Thank you. Easier than I thought. Something for the weekend
@jaymcd In case you didn't get notified of my reply, you can see it here:
@jddj Thank you for the feedback! I like knowing people have used it
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
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?
1 replyHey, 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.
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.
2 repliesHi @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 https://github.com/cp2004/Octoprint-Upgrade-To-Py3#command-line-options
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'
2 replies
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.
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.
Worked perfectly for me as well (after the long process of upgrading OctoPi and other things I had to reinstall.)
There is a python 3 compatible fork and that person is taking over as maintainer to the official repo.
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
thanks, i will try this evening
I got this too - you need to run it as the pi user, not as root...
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:
1 replypi@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 overwrittenPress [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!
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
1 reply@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 replyThanks![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
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.
1 reply(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
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 replyI started the upgrade-script on my Octopi 0.17 with Octoprint 1.4.12.
I confimed all prompts with enter, and entered my password when prompted in order to install python3-dev. Immediately after entering my password, the putty-session was terminated by the host.
Octoprint continued to work. I tried to restart the script, after entering my password for Python3-dev I got a cryptic message about wrong data in the stream.
Next step was to download and start the downgrade-script, which failed, claiming there is no data in the backup path.
At this point, my Octoprint installation does no longer work. The server is reachable via SSH, but Octoprint is not running.
When I ssh into the system, I see:
What is the best way to recover? I have an almost up-to-date backup of my Octoprint config, and I can backup my Klipper-config.
Best,
Detlev
1 replyFound the solution lol...just need to reboot the pi...and the 2nd instance is up again...
@Detlev_Rackow - could you open a separate topic, so I can discuss it through with you, and get a solution - it is fully possible to recover, since nothing of the old install gets deleted.
Easier than the comments of this post, where discussion gets confusing with many people.
Funny, I made a super half-hearted investigation to switch to Python 3 just last week. Saw it wasn't super easy and gave up. Then this post came out. Ran it on my most recent of three OctoPi 0.17 installs and it was super easy. No problems at all. Got the other two running right now but looks like I'll be able to switch everything to Python 3 with no problem at all. Thank you for making it so easy!
1 replyI followed the instructions but get this error
pi@octopi:~ sudo curl -L https://get.octoprint.org/upgrade.py --output upgrade.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 154 100 154 0 0 1062 0 --:--:-- --:--:-- --:--:-- 1062
100 39304 100 39304 0 0 92917 0 --:--:-- --:--:-- --:--:-- 92917
pi@octopi:~ sudo python3 upgrade.py
File "upgrade.py", line 1
<!DOCTYPE html>
^
SyntaxError: invalid syntax
Can anyone help?
1 replyIf you enter the command(s) you typed as Preformatted text (</>
icon above), we might be able to see if there was a typo. Using PuTTY you can cut the command out of this thread and paste it in the SSH terminal window using right-click.
@uppermill - wrong URL, check it.
Should be https://get.octoprint.org/py3/upgrade.py
edit as @b-morgan says, just copy and paste it into an SSH window to get it exactly right
@cmh Thanks for the feedback
The script has been around in a sort of 'testing' state until now, I first wrote it back in June. There's a couple of forum posts etc. etc. but anyway great to hear it worked well for you.
Worked great! Thanks!!
Thanks for the fast responses. I updated the URL and everything has now completed successfully.
@Charlie_Powell Sweet, nice and easy, looks good. Pi4, 0.12-0.15 (Can't remember where this started) original install with about 10 plugins and standard updates/upgrades since. Took less than 5 minutes to run and looks to be working fine. Thanks for the sweet script!
All went well with the base install, It initially screwed my GPX plugin. I couldn't install the plugin from the plugin manager so installed it manually. Re-created the gpx.ini file and away I went.
I'm running OctoPrint 1.4.2, OctoPi 0.18.0.
Thank you
1 replyIf I were a newbie to Linux then I would have given up, So a message to anyone who is new and cannot follow logs and diagnose issues in Linux I would avoid the upgrade if you have tons of plugins. But thank you to whoever created this script. I'm guessing @jneilliii?
Nope not me, @Charlie_Powell all the way. He's new on the scene and has quickly become a plugin author (WS281x LED Status) as well as a huge help in discord, here in the forum, and assisting Gina with issue/bug maintenance triage and fixing.
1 replyThanks @Charlie_Powell
@Charlie_Powell Sorry, that is not correct. Klipper itself is written in Python. Look at this folder:
klippy is the core of Klipper's functionality. Klipper is still based on Python 2.7.There is even a branch of Klipper where work is being done on porting to Python 3, but it's stale. "Master" gets updates on a daily basis, the branch for Python 3 is three months old.
Octoklipper is simply a regular plugin for Octoprint, written by another guy.
It is not necessary for interoperability, but makes configuration of Klipper available through Octoprint which is pretty nice.
The plugin has a fork for Python 3 which seems to work pretty well.
Klipper itself seems quite stuck in 2.7. The maintainers are very active in developing functional improvements, but questions about Python 3 get canned answer. Since it's nothing I need to expose to the internet, that's sort of ok - as long as it stays compatible with my Octopi.
1 replyAh ok, I read the wrong thing (maybe it was the printer firmware side? can't remember!), sorry.
I have done some more poking and it definitely creates its own virtual environment, looked through the install scripts - as good software does - so there should be no issue at all, since we are only touching OctoPrint's environment.
Klipper will still work, since all OctoPi distributions have both Python 2.7 and 3.x installed at a system level - that does not change in the script, the only thing that does is the virtual environment where OctoPrint (not klipper) is installed.
Hope that makes sense.
1 replyTo add to that: while it is not possible to eg run OctoPrint with Python 3 and a plugin for OctoPrint with Python 2, it is possible to run OctoPrint with Python 3 and Klipper with Python 2 because they are different processes.
1 replyFrom what I have heard, no, the plugin is not required. If you do intend to use the plugin with OctoPrint running on Python 3, you must use the Python 3 version of the plugin. However, Klipper itself can be running on Python 2.
1 replyRead (and follow) the instructions on upgrading more carefully. The upgrade script is not a plugin, so it should not be installed as a plugin. The upgrade script is something you would run in an SSH session (eg Putty), or using a keyboard and display on the Pi.
@simpat1zq - there will be within the week, its being adopted by someone who has updated it to be Py3 compatible.
@jdcamc I'm not sure what to say.... This is not a plugin, read the instructions, it goes nowhere near the plugin manager.
1 replyYou can use Octoprint and Klipper without the plugin. The printer-queue is /tmp/primter which looks a bit odd, but for Octoprint, Klipper behaves like a standard printer. It handles the common G-codes like temperature control, G28, G1 and the like. The plugin gives you the capability to edit the Klipper-configuration with data like default acceleration etc from within the browser. This is a huge bonus over Marlin where simple things like configuring ABL require the compilation of a new firmware file.
The upgrade worked very well. So simple. Thanks for making the upgrade easy. I did have one issue after the upgrade. Trying to install a new plugin, I got the error message that my OctoPrint was not connected to the internet. I ran through all of the connectivity checks and it was connected. I spent a little time trying to identify the issue with no success. I rebooted Octoprint and the Raspberry Pi several times, no joy.
I decided to manually download the zip file for the plugin that I wanted. It upgraded and once the system rebooted it was working fine.
Thanks to all for making this so super simple.
Not running it as root solved my issue.
@Niamh - Filament manager got taken over by @OllisGit yesterday (maybe the day before), so you're in luck!
Release notes https://github.com/OllisGit/OctoPrint-FilamentManager/releases/tag/1.6.0
You should get a notice that it has been transferred, but you need to reinstall as the updates are looking in the wrong place. See plugin notices if you don't get it, at the bottom Plugin notices
If you go to Settings > Plugin Manger > Get More
then find 'Filament Manager' there should be a reinstall button beside it you may need to check it is not filtered on installed plugins only.
Or if you can't find that, uninstall without cleaning data (you'll lose all your config) then install it again.
I am running .17. I rcvd this error:
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/dpkg/status
E: The package lists or status file could not be parsed or opened.
ERROR: failed to update package list
Please try manually
Cleaning up...
Fatal error: Exiting
Try updating the package list manually, with sudo apt-get update
, that seems an issue with your OctoPi installation - nothing I can do about that.
Also check it is connected to the internet, then if you still need help solving the problem please open a separate topic in 'Get help'.
Definitely connected to the internet
pi@octopi:~ $ sudo apt-get update
[sudo] password for pi:
Get:1 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Fetched 15.0 kB in 1s (13.8 kB/s)
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/dpkg/status
E: The package lists or status file could not be parsed or opened.
Thanks for the upgrade script.
I found that I had 3 plugins that used python V2, so deleted them first.
The upgrade script worked flawlessly
I now just have to wait for the plugin owners to upgrade their pplugins to V3
cheers
ian
I wish these 4 plugins would be upgraded to python 3
EDIT: Whoahh, I just realised that after removing the Octoklipper 0.2.5 plugin I could install the 0.3.1 version from Alice Weigt, which is python 3 compatible!!!
Hope that helps anyone
EDIT 2: Success: OctoPrint 1.4.2 Python 3.7.3 OctoPi 0.17.0 (deactivated the three plugins before upgrading with the script).
THANKS
Yeah, the Klipper plugin it was adopted officially yesterday. Go and let the plugin authors know that you want Python 3 compatibility, for the others, at some point OctoPrint will drop Py2 support so they need to be made compatible.
1 replyOn every plugin there is at least one "python 3 upgrade" issue.
There should have been a link when installing that plugin that extra action is required. And @jneilliii posted that link in the comments, previously.
1 reply