All Projects → cp2004 → Octoprint-Upgrade-To-Py3

cp2004 / Octoprint-Upgrade-To-Py3

Licence: GPL-3.0 license
A script to move an existing OctoPrint install from Python 2 to Python 3

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Octoprint-Upgrade-To-Py3

OctoPrint-TasmotaMQTT
No description or website provided.
Stars: ✭ 17 (-70.69%)
Mutual labels:  octoprint
OctoPrint-Octoremote
A hardware remote for Octoprint controlled 3D Printers
Stars: ✭ 23 (-60.34%)
Mutual labels:  octoprint
octo4a
Use your old Android device as an OctoPrint server.
Stars: ✭ 1,000 (+1624.14%)
Mutual labels:  octoprint
OctoPrint-CuraEngineLegacy
Plugin for slicing via Cura Legacy from within OctoPrint
Stars: ✭ 16 (-72.41%)
Mutual labels:  octoprint
Octoprint
OctoPrint is the snappy web interface for your 3D printer!
Stars: ✭ 6,267 (+10705.17%)
Mutual labels:  octoprint
pizero-webcam-tutorial
A step-by-step tutorial for setting up a Raspberry Pi Zero W computer as a webcam
Stars: ✭ 25 (-56.9%)
Mutual labels:  octoprint
OctoPrint-AstroPrint
Connect your OctoPrint device to the AstroPrint 3D Printing Cloud
Stars: ✭ 26 (-55.17%)
Mutual labels:  octoprint
Simplify3D-to-OctoPrint
Upload GCODE generated by Simplify3D to OctoPrint
Stars: ✭ 34 (-41.38%)
Mutual labels:  octoprint
OctoPrint-Smuff
OctoPrint Plugin for SMuFF
Stars: ✭ 17 (-70.69%)
Mutual labels:  octoprint
OctoPrint-GitFiles
With this plugin, you can use a github/gitlab repository for keeping your OctoPrint Files collection up-to-date.
Stars: ✭ 28 (-51.72%)
Mutual labels:  octoprint
ioBroker.octoprint
ioBroker adapter to manage your 3D printer over ioBroker
Stars: ✭ 31 (-46.55%)
Mutual labels:  octoprint
Octoprint-Cancelobject
No description or website provided.
Stars: ✭ 90 (+55.17%)
Mutual labels:  octoprint
OctoPrint-DisplayProgress
Displays the job progress on the printer's display
Stars: ✭ 19 (-67.24%)
Mutual labels:  octoprint
OctoPrint-CameraSettings
An OctoPrint plugin that allows a user to interactively change camera settings.
Stars: ✭ 31 (-46.55%)
Mutual labels:  octoprint
OctoPrint-MultiColors
Inject GCODE at specified layers to allow multi color printing via filament change
Stars: ✭ 20 (-65.52%)
Mutual labels:  octoprint
octocitrico
OctoPrint for other fruits
Stars: ✭ 76 (+31.03%)
Mutual labels:  octoprint
OctoPrint-GcodeEditor
Edit gcode on OctoPrint
Stars: ✭ 20 (-65.52%)
Mutual labels:  octoprint
threedy
Home Assistant card for 3D printer status and management.
Stars: ✭ 159 (+174.14%)
Mutual labels:  octoprint
OctoPrint-SimpleEmergencyStop
A simple plugin that add an emergency stop buton on NavBar of OctoPrint
Stars: ✭ 17 (-70.69%)
Mutual labels:  octoprint
OctoPrint-Webhooks
Make OctoPrint events call your custom webhooks!
Stars: ✭ 27 (-53.45%)
Mutual labels:  octoprint

Upgrade your OctoPrint install to Python 3!

Many new plugins only support Python 3, and do not support Python 2 anymore. If you get a message like this installing a plugin:

ERROR: Package 'OctoDash-Companion' requires a different Python: 2.7.16 not in '>=3.3, <4'

You need to upgrade your OctoPrint install to use Python 3, rather than Python 2.

You have several options, depending on how you have installed OctoPrint:

Re-flashing your OS

This is the easiest way to upgrade if you are using OctoPi, since you can re-flash the base OS and it is using Python 3.

  1. Take a backup from inside OctoPrint's 'Backup and Restore' tab, and download it.
  2. Download & install OctoPi 0.18
  3. Once installed, you can restore your backup using 'Backup and Restore' again.

Using this script

Requirements

  • Python 3.6+ installed as python3 on the system
  • Linux install
  • OctoPrint 1.4.0+ for Python 3 compatibility. Note: The script will install the latest stable version of OctoPrint when you run it.

If you don't meet the above requirements, then please see 'What can I do if my system is not supported' below.

Running the script

Run the following 2 commands in the OS terminal (either through SSH or a connected keyboard/monitor) to start the upgrade:

curl -L https://get.octoprint.org/py3/upgrade.py --output upgrade.py
python3 upgrade.py

If you are not running OctoPi, you will be prompted to provide:

  • The path to the venv (/home/pi/oprint on OctoPi)
  • Configuration directory (/home/pi/.octoprint)
  • Command to stop (sudo service octoprint stop)
  • Command to start (sudo service octoprint start)

You may also be asked to provide the sudo password so the script can install python3-dev, a package required to install some plugins. (If your machine is not running passwordless sudo)

Once the install has finished (and you have tested it works, of course) you can safely remove the folder /path/to/venv.bak containing your old Python 2 environment.

On an OctoPi install, this would be at /home/pi/oprint.bak

Command line options

There are two command line options available, which you can use. Both optional:

  • -f or --force: Forces through any 'confirmations' where you would have to press enter to continue. Note that you may still need to enter your configuration or sudo password.
  • -c or --custom: Force use of custom input, as would be standard on non-OctoPi installs. Useful if you have multiple installs, but started on OctoPi.

Returning to the old install

If the install fails, then you can safely return to the old install by restoring the backup. It is just the old environment renamed, so you can move it back to it's original position.

You can use the other script in this repo, go_back.py to return to the old install. Usage is similar to the upgrade script:

curl -L https://raw.githubusercontent.com/cp2004/Octoprint-Upgrade-To-Py3/master/go_back.py --output go_back.py
python3 go_back.py

What do I do if my system is not supported?

OctoPi 0.16 or earlier

OctoPrint is only compatible with Python 3.6+. As a result, on earlier versions of OctoPi that were not based on Debian Buster, it is not possible to run this script on those OctoPi versions, since they don't have a new enough Python install available.

Recommended route to Python 3

Manual installs

If you are running Windows, MacOS or your system does not work with this script for whatever reason, then you will need to perform the upgrade manually.

The basic steps boil down to this:

  • Create a backup of your OctoPrint install (not available on Windows)
  • Save a copy of your current virtual environment
  • Create a new virtual environment based on Python 3
  • Install OctoPrint in the virtual environment
  • Restore the backup you downloaded earlier.

For more detailed steps, please refer to the OS specific install guides on the download page

Blog post

For a full explanation of why this script is here, please make sure to read the blog post I wrote about this on the OctoPrint blog: Upgrade Your OctoPrint Install to Python 3!

Limitations of this script

  • The script is unable to restore plugins that are not on the official repository. If it cannot find the plugin listed it will tell you and you should install them manually afterwards.

  • The script is not able to tell you if your plugins are not Python 3 compatible, you will have to check in the OctoPrint plugin manager afterwards to find incompatible ones. Recommended to check before upgrading.

Contributing

Please open an issue if you find something wrong, or have a feature request. If you would like to make a PR, please do so against the devel branch as master is the download branch for users and I don't want changes that accidentally break something! If your are making a PR for a big feature, please open an issue first so we can discuss.

Sponsors

As well as 5 others supporting me regularly through GitHub Sponsors!

Supporting my efforts

I created this project in my spare time, so if you have found it useful or enjoyed using it then please consider supporting it's development!. You can sponsor monthly or one time, for any amount you choose.

🔨

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].