Can't update Octoprint from 1.6.1 to 1.7.3

I'm trying to update from 1.6.1 to 1.7.3, but I receive the attached error and the update is aborted.
Can someone help me understand what this error means? And/or provide a possible solution (ie. do I need to backup and reinstall Octoprint or is there some other method via CLI?).

I did a sudo apt update and sudo apt upgrade also.
I'm running on a Raspberry Pi 4

octoprint-systeminfo-20240426004419.zip (461.1 KB)

ERROR: Command errored out with exit status 1:
command: /home/pi/oprint/bin/python2 /home/pi/oprint/local/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-f4rums/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- 'setuptools>=40.8.0' wheel
cwd: None
Complete output (24 lines):
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/pi/oprint/lib/python2.7/site-packages/pip/__main__.py", line 16, in <module>
from pip._internal.main import main as _main  # isort:skip # noqa
File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/main.py", line 13, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/cli/autocompletion.py", line 11, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/cli/cmdoptions.py", line 25, in <module>
from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/locations.py", line 18, in <module>
from pip._internal.utils import appdirs
File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/utils/appdirs.py", line 16, in <module>
from pip._internal.utils.compat import WINDOWS, expanduser
File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/utils/compat.py", line 17, in <module>
from pip._vendor.urllib3.util import IS_PYOPENSSL
File "/home/pi/oprint/lib/python2.7/site-packages/pip/_vendor/urllib3/__init__.py", line 21, in <module>
from logging import NullHandler
ImportError: cannot import name NullHandler

Hello @ampedpfv !

You are running on Python 2.7. OctoPrint 1.7.0 and higher requires Python 3.

I recommend to make a backup and start all over with a recent OctoPi installation.

Thank you!
I'll try that and report back.
I just tried updating the pi to the latest Python version 3.12 and setting it as the default, but it didn't work, so I think it's better to start over as you suggested.

So for anyone else reading this, I solved this with two steps:

  1. Install the latest version of Python 3 on the PI.
    How To Install the Latest Python Version on Raspberry Pi? – RaspberryTips
  2. Update Octoprint to use Python 3 using the instructions at the below link:
    Upgrading your OctoPrint install to Python 3

@Ewald_Ikemann thanks for pointing me in the right direction!

2 Likes