Upgrading to PIP 22.0.2

I upgraded PIP to 22.0 on Jan. 31. After that I was prompted by Octoprint to update to 22.0.2. When I try to update PIP, it fails.

I have uploaded the Systeminfo Bundle.
octoprint-systeminfo-20220202162812.zip (861.9 KB)

I'm seeing this in the plugin_softwareupdate_console.log.

2022-02-02 15:06:19,629 ! File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 427, in _raise_error
2022-02-02 15:06:19,629 ! "HTML doctype missing or incorrect. Expected .\n\n"
2022-02-02 15:06:19,630 ! ValueError: HTML doctype missing or incorrect. Expected .
2022-02-02 15:06:19,630 !
2022-02-02 15:06:19,630 ! If you believe this error to be incorrect, try passing the command line option --use-deprecated=html5lib and please leave a comment on the pip issue at [DEPRECATION] Moving away from html5lib to html.parser · Issue #10825 · pypa/pip · GitHub.

Have you looked into this?

There was the result of a (fairly bad) bug in pip 22.0, which was later fixed. Somehow there must be a way to upgrade pip without using pip. I can't research it now (only on mobile) but there might be some command options that can be used to avoid the problems - maybe downloading the file manually and ignoring the indexes?

Installing and copying pip bins and the lib directory from the system might be a way to upgrade(or downgrade) it.

Not sure why I read through that whole thing, but it does have a couple of methods for getting around that, notably:

Use python -m pip uninstall pip && python -m ensurepip to get a version of pip that was bundled with your Python version.

Presumably you could then upgrade to the fixed version from there.

Actually try this:

mkdir ~/tmp
cd ~/
source ~/oprint/bin/activate
curl 'https://files.pythonhosted.org/packages/83/b5/df8640236faa5a3cb80bfafd68e9fb4b22578208b8398c032ccff803f9e0/pip-22.0.2-py3-none-any.whl#sha256=682eabc4716bfce606aca8dab488e9c7b58b0737e9001004eb858cdafcd8dbdd' -o pip-22.0.2-py3-none-any.whl
~/oprint/bin/python3 pip-22.0.2-py3-none-any.whl/pip install --no-index pip-22.0.2-py3-none-any.whl

ensurepip doesn't work in some cases where pip would be installed via apt or something else on the system - it might work in the venv, I've never tried it.

That particular example was for a venv.

1 Like

Thank you @kantlivelong. That solved the problem. I was prompted to upgrade PIP to 22.0.3 after restarting the server.

since the "rollback" to 22.0.2 did't work for me (update in octoprint were still giving errors), here ist code to fore the pip 22.0.3 installation directly
its using the same repository which is used if you try to install pip via octoprint.

mkdir ~/tmp
cd ~/
source ~/oprint/bin/activate
curl 'https://www.piwheels.org/simple/pip/pip-22.0.3-py3-none-any.whl' -o pip-22.0.3-py3-none-any.whl
~/oprint/bin/python3 pip-22.0.3-py3-none-any.whl/pip install --force-reinstall --no-index pip-22.0.3-py3-none-any.whl

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.