Can't update from 1.4.0 to 1.5.3 : cannot import name NullHandler

What is the problem?

I tried to update my Octoprint installation from 1.4.0 to 1.5.3. It threw the error cannot import name NullHandler (see logs below)

What did you already try to solve it?

I did the following:

sudo apt-get update
sudo apt-get upgrade
pip install --upgrade pip
pip install --force-reinstall OctoPrint==1.4.0 / 1.5.3

Complete Logs

octoprint.log

2021-02-23 10:17:18,458 - octoprint.plugins.softwareupdate - INFO - Starting update of octoprint to 1.5.3...
2021-02-23 10:17:35,800 - octoprint.plugins.softwareupdate - ERROR - Update of octoprint 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/python2.7/site-packages/octoprint/plugins/softwareupdate/__init__.py", line 1060, in _perform_update
    update_result = updater.perform_update(target, populated_check, target_version, log_cb=self._log, online=online)
  File "/home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/softwareupdate/updaters/pip.py", line 116, in perform_update
    raise exceptions.UpdateError("o", (stdout, stderr))
UpdateError

plugin_softwareupdate_console.log

Installing build dependencies: started
2021-02-23 10:33:40,225 > Installing build dependencies: finished with status 'error'
2021-02-23 10:33:40,228 ! ERROR: Command errored out with exit status 1:
2021-02-23 10:33:40,229 ! 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-A0D5Ga/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 wheel Cython
2021-02-23 10:33:40,229 ! cwd: None
2021-02-23 10:33:40,230 ! Complete output (24 lines):
2021-02-23 10:33:40,230 ! Traceback (most recent call last):
2021-02-23 10:33:40,230 ! File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
2021-02-23 10:33:40,231 ! "__main__", fname, loader, pkg_name)
2021-02-23 10:33:40,231 ! File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
2021-02-23 10:33:40,231 ! exec code in run_globals
2021-02-23 10:33:40,232 ! File "/home/pi/oprint/lib/python2.7/site-packages/pip/__main__.py", line 16, in <module>
2021-02-23 10:33:40,232 ! from pip._internal.main import main as _main  # isort:skip # noqa
2021-02-23 10:33:40,233 ! File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/main.py", line 13, in <module>
2021-02-23 10:33:40,233 ! from pip._internal.cli.autocompletion import autocomplete
2021-02-23 10:33:40,233 ! File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/cli/autocompletion.py", line 11, in <module>
2021-02-23 10:33:40,234 ! from pip._internal.cli.main_parser import create_main_parser
2021-02-23 10:33:40,234 ! File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
2021-02-23 10:33:40,234 ! from pip._internal.cli import cmdoptions
2021-02-23 10:33:40,235 ! File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/cli/cmdoptions.py", line 25, in <module>
2021-02-23 10:33:40,235 ! from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
2021-02-23 10:33:40,235 ! File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/locations.py", line 18, in <module>
2021-02-23 10:33:40,236 ! from pip._internal.utils import appdirs
2021-02-23 10:33:40,236 ! File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/utils/appdirs.py", line 16, in <module>
2021-02-23 10:33:40,236 ! from pip._internal.utils.compat import WINDOWS, expanduser
2021-02-23 10:33:40,237 ! File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/utils/compat.py", line 17, in <module>
2021-02-23 10:33:40,237 ! from pip._vendor.urllib3.util import IS_PYOPENSSL
2021-02-23 10:33:40,237 ! File "/home/pi/oprint/lib/python2.7/site-packages/pip/_vendor/urllib3/__init__.py", line 21, in <module>
2021-02-23 10:33:40,238 ! from logging import NullHandler
2021-02-23 10:33:40,238 ! ImportError: cannot import name NullHandler
2021-02-23 10:33:40,238 ! ----------------------------------------
2021-02-23 10:33:40,239 ! ERROR: Command errored out with exit status 1: /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-A0D5Ga/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 wheel Cython Check the logs for full command output.

Additional information about your setup

Runing on a Pi 4 with octopi 0.17.0.

Thanks a lot !

Try ~/oprint/bin/pip uninstall logging from SSH in the terminal.

Do you have the PrintTimeGenius plugin?

2 Likes

Awesome, that did the trick ! Would you mind explaining me why ? I do have the PrintTimeGenius plugin indeed.
Thanks a lot !

Print Time Genius seems to be pulling in a dependency on a very old logging library, that it shouldn't. This conflicts with the Python standard library. The plugin author was asked to remove it yesterday.

Ok I see. Thanks again for your help !

1 Like

This is still an issue for me in 1.7.2 upgrade so thank you so much for having posted this.

1 Like