Problem upgrading octorelay

Hi, I've been using OctoRelay for some time and currently at version 4.2.0. I have tried to upgrade to the latest version (currently 5.1.0) and it is failing. My python version is 3.12.4. The logs have a couple of errors:

ERROR: Package 'octorelay' requires a different Python: 3.7.3 not in '<4,>=3.9'
2024-11-12 15:08:27,344 - octoprint.plugins.softwareupdate - ERROR - Update of octorelay can not be performed, please also check plugin_softwareupdate_console.log for possible causes of this
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugins/softwareupdate/__init__.py", line 2214, in _perform_update
    force=force,
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugins/softwareupdate/updaters/pip.py", line 127, in perform_update
    "Error while executing pip install", (stdout, stderr)
octoprint.plugins.softwareupdate.exceptions.UpdateError: Error while executing pip install

I know next to nothing about python so any help would be appreceiated.

You need a newer version of Python. If on OctoPi you'll want to flash to the latest image version.

I want to update a plugin called OctoRelay and I am running 1 under the latest version (3.12.4) the documentation for the plugin says that I need at least 3.9 which I satisfy. I have upgraded OctoPrint to the latest version without a hitch.

The error and says otherwise.

ERROR: Package 'octorelay' requires a different Python: 3.7.3

If your system has Python 3.9+ then you'll need to recreate the OctoPrint venv using the newer Python version and reinstall.

How do I do that pleae?

Backup and reflash to the latest OctoPi version.

What do you mean 'reflash' my understanding is to use the raspbery pi imager to create a new image io the SD Card. and what do I backup please?

I really am confused here. I am running OctoPrint 1.10.3 without any problems, except the plugin update. Is this not the latest version? If so, why do I need to update please?

What is being suggested is that to solve your issue you should create a new install of OctoPrint by following the instructions you seem to already understand of creating(Flashing) the OctoPi image and then use that in your existing Rasbery Pi.

But take note, before you do that step, it is suggested that you create a backup of your existing install. This is done from inside OctoPrint. There is an existing Plugin (Backup & Restore) to make this easy. You can find this in the OctoPring Settings dialog "OCTOPRINT" section. Follow the instructions for that Plugin to complete the backUp process.

Then you do the process of creating a new fresh install of OctoPi/OctoPrint. During setup you will have the option of applying the backUp you created. Do that...

If you follow these steps, you should have your issue resolved.

The real issue you have is that your Pi has an old version of Python on it. The one that is running the Octoprint instance. You maybe think you installed a newer version of Python but you did not do it as needed. This is proven by the error in your log.

Since you do not seem to be familiar with the details needed to get that right. It would be tedious for someone to walk you through that. So it is suggested that you do the above to get you where you need to be. It is likely the process with the best chance for success as well as the fastest way to get there.

2 Likes

There's an easier way I think. @foosel created this for re-creating the venv.

https://github.com/OctoPrint/venv-tool#migrating-a-venv-to-a-newer-python-version

I suspect the octopi image you flashed was version 0.18, which came pre-loaded with python 3.7. The OctoPi 1.0.0 release ships with Python 3.9. As others have already mentioned, reflashing the octopi 1.0.0 version would get you to the minimum required python version needed for that plugin, but the link I just shared for re-creating the venv may be another approach if you have truly successfully upgraded your OS system level python version to 3.12.

EDIT: a simple way to verify that is if you SSH to the pi and run python --version it will tell you what version you actually have at the OS system level.

Many thanks for the help. In principal this solution seems the best way forward. However I did not know where the 'venv' was. I had previously successfully installed 3.12 without problem.

Many thanks for the solution. If I'd have known that OctoPi uses a 'private' copy of python it would have made more sense. The backup/restore worked a treat (I guess that I'm not using third party plugins)