Bug 2143799 - pip update warning has a logging error when /usr/bin/pip3 does not exist and pip3 exists on $PATH
Summary: pip update warning has a logging error when /usr/bin/pip3 does not exist and ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python3.11
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-11-17 22:25 UTC by Jay W
Modified: 2022-12-03 02:01 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-12-03 02:01:04 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github pypa pip issues 11309 0 None closed Logging error when checking for new version of pip. 2022-11-18 16:03:14 UTC
Github pypa pip pull 11318 0 None Merged Check if binary_executable exists 2022-11-18 16:03:14 UTC

Description Jay W 2022-11-17 22:25:20 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:

[jaydoubleu@fedora ~]$ python3 -m ensurepip
Defaulting to user installation because normal site-packages is not writeable
...


[jaydoubleu@fedora ~]$ python3 -m pip install pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.11/site-packages (22.2.2)
--- Logging error ---
Traceback (most recent call last):
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 177, in emit
    self.console.print(renderable, overflow="ignore", crop=False, style=style)
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1673, in print
    extend(render(renderable, render_options))
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1305, in render
    for render_output in iter_render:
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
    for line in lines:
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_vendor/rich/segment.py", line 249, in split_lines
    for segment in segments:
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1283, in render
    renderable = rich_cast(renderable)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
    renderable = cast_method()
                 ^^^^^^^^^^^^^
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
    pip_cmd = get_best_invocation_for_this_pip()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_internal/utils/entrypoints.py", line 59, in get_best_invocation_for_this_pip
    if found_executable and os.path.samefile(
                            ^^^^^^^^^^^^^^^^^
  File "<frozen genericpath>", line 101, in samefile
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip3'
Call stack:
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    self.handle_pip_version_check(options)
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 190, in handle_pip_version_check
    pip_self_version_check(session, options)
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_internal/self_outdated_check.py", line 236, in pip_self_version_check
    logger.warning("[present-rich] %s", upgrade_prompt)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1501, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1634, in _log
    self.handle(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1644, in handle
    self.callHandlers(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1706, in callHandlers
    hdlr.handle(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 978, in handle
    self.emit(record)
  File "/var/home/jaydoubleu/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 179, in emit
    self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.2.2', new='22.3.1'),)



...

FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip3'

Comment 1 Miro Hrončok 2022-11-18 10:36:17 UTC
I cannot reproduce this.

What is your initial setup? Is pip installed via dnf or not? Is this a clean installation of Fedora 37?

Comment 2 Jay W 2022-11-18 10:44:22 UTC
Apologies, I should've specified that this is on a clean install of Fedora Silverblue 37

Comment 3 Miro Hrončok 2022-11-18 15:08:41 UTC
I can reproduce this on Silverblue.

[test@fedora ~]$ python3 -m ensurepip
Defaulting to user installation because normal site-packages is not writeable
Looking in links: /tmp/tmp7as4821c
Requirement already satisfied: setuptools in /usr/lib/python3.11/site-packages (62.6.0)
Processing /tmp/tmp7as4821c/pip-22.2.2-py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-22.2.2
[test@fedora ~]$ python3 -m pip install pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.11/site-packages (22.2.2)
--- Logging error ---
Traceback (most recent call last):
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 177, in emit
    self.console.print(renderable, overflow="ignore", crop=False, style=style)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1673, in print
    extend(render(renderable, render_options))
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1305, in render
    for render_output in iter_render:
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
    for line in lines:
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_vendor/rich/segment.py", line 249, in split_lines
    for segment in segments:
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1283, in render
    renderable = rich_cast(renderable)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
    renderable = cast_method()
                 ^^^^^^^^^^^^^
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
    pip_cmd = get_best_invocation_for_this_pip()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/utils/entrypoints.py", line 59, in get_best_invocation_for_this_pip
    if found_executable and os.path.samefile(
                            ^^^^^^^^^^^^^^^^^
  File "<frozen genericpath>", line 101, in samefile
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip3'
Call stack:
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    self.handle_pip_version_check(options)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 190, in handle_pip_version_check
    pip_self_version_check(session, options)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/self_outdated_check.py", line 236, in pip_self_version_check
    logger.warning("[present-rich] %s", upgrade_prompt)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1501, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1634, in _log
    self.handle(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1644, in handle
    self.callHandlers(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1706, in callHandlers
    hdlr.handle(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 978, in handle
    self.emit(record)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 179, in emit
    self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.2.2', new='22.3.1'),)
[test@fedora ~]$ python3 -m pip list
Package            Version
------------------ ---------
Brlapi             0.8.4
chardet            5.0.0
charset-normalizer 2.1.0
click              8.1.3
cupshelpers        1.0
dbus-python        1.2.18
distro             1.7.0
fedora-third-party 0.10
file-magic         0.4.0
fros               1.1
idna               3.3
nftables           0.1
olefile            0.46
packaging          21.3
pexpect            4.8.0
Pillow             9.2.0
pip                22.2.2
ptyprocess         0.6.0
pycairo            1.21.0
pycups             2.0.1
pycurl             7.45.1
pyenchant          3.2.2
PyGObject          3.42.2
pyparsing          3.0.9
PySocks            1.7.1
pyxdg              0.27
PyYAML             6.0
regex              2022.9.13
requests           2.28.1
rpm                4.18.0
selinux            3.4
sepolicy           3.4
setools            4.4.0
setuptools         62.6.0
simpleaudio        1.0.4
six                1.16.0
sos                4.4
urllib3            1.26.12
--- Logging error ---
Traceback (most recent call last):
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 177, in emit
    self.console.print(renderable, overflow="ignore", crop=False, style=style)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1673, in print
    extend(render(renderable, render_options))
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1305, in render
    for render_output in iter_render:
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
    for line in lines:
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_vendor/rich/segment.py", line 249, in split_lines
    for segment in segments:
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1283, in render
    renderable = rich_cast(renderable)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
    renderable = cast_method()
                 ^^^^^^^^^^^^^
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
    pip_cmd = get_best_invocation_for_this_pip()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/utils/entrypoints.py", line 59, in get_best_invocation_for_this_pip
    if found_executable and os.path.samefile(
                            ^^^^^^^^^^^^^^^^^
  File "<frozen genericpath>", line 101, in samefile
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip3'
Call stack:
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    self.handle_pip_version_check(options)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 190, in handle_pip_version_check
    pip_self_version_check(session, options)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/self_outdated_check.py", line 236, in pip_self_version_check
    logger.warning("[present-rich] %s", upgrade_prompt)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1501, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1634, in _log
    self.handle(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1644, in handle
    self.callHandlers(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1706, in callHandlers
    hdlr.handle(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 978, in handle
    self.emit(record)
  File "/var/home/test/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 179, in emit
    self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.2.2', new='22.3.1'),)

Comment 4 Miro Hrončok 2022-11-18 15:18:24 UTC
OK, I can reproduce this in mock as well:

<mock-chroot> sh-5.2$ python3 -m ensurepip
Defaulting to user installation because normal site-packages is not writeable
Looking in links: /tmp/tmp6i_kmk_5
Processing /tmp/tmp6i_kmk_5/setuptools-62.6.0-py3-none-any.whl
Processing /tmp/tmp6i_kmk_5/pip-22.2.2-py3-none-any.whl
Installing collected packages: setuptools, pip
  WARNING: The scripts pip3 and pip3.11 are installed in '/builddir/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-22.2.2 setuptools-62.6.0

# this is important to reproduce:
<mock-chroot> sh-5.2$ export PATH=/builddir/.local/bin:$PATH

<mock-chroot> sh-5.2$ pip3 list
Package    Version
---------- -------
pip        22.2.2
setuptools 62.6.0
--- Logging error ---
Traceback (most recent call last):
  File "/builddir/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 177, in emit
    self.console.print(renderable, overflow="ignore", crop=False, style=style)
  File "/builddir/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1673, in print
    extend(render(renderable, render_options))
  File "/builddir/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1305, in render
    for render_output in iter_render:
  File "/builddir/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
    for line in lines:
  File "/builddir/.local/lib/python3.11/site-packages/pip/_vendor/rich/segment.py", line 249, in split_lines
    for segment in segments:
  File "/builddir/.local/lib/python3.11/site-packages/pip/_vendor/rich/console.py", line 1283, in render
    renderable = rich_cast(renderable)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/.local/lib/python3.11/site-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
    renderable = cast_method()
                 ^^^^^^^^^^^^^
  File "/builddir/.local/lib/python3.11/site-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
    pip_cmd = get_best_invocation_for_this_pip()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/.local/lib/python3.11/site-packages/pip/_internal/utils/entrypoints.py", line 59, in get_best_invocation_for_this_pip
    if found_executable and os.path.samefile(
                            ^^^^^^^^^^^^^^^^^
  File "<frozen genericpath>", line 101, in samefile
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip3'
Call stack:
  File "/builddir/.local/bin/pip3", line 8, in <module>
    sys.exit(main())
  File "/builddir/.local/lib/python3.11/site-packages/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
  File "/builddir/.local/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
  File "/builddir/.local/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    self.handle_pip_version_check(options)
  File "/builddir/.local/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 190, in handle_pip_version_check
    pip_self_version_check(session, options)
  File "/builddir/.local/lib/python3.11/site-packages/pip/_internal/self_outdated_check.py", line 236, in pip_self_version_check
    logger.warning("[present-rich] %s", upgrade_prompt)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1501, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1634, in _log
    self.handle(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1644, in handle
    self.callHandlers(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 1706, in callHandlers
    hdlr.handle(record)
  File "/usr/lib64/python3.11/logging/__init__.py", line 978, in handle
    self.emit(record)
  File "/builddir/.local/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 179, in emit
    self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.2.2', new='22.3.1'),)

Comment 5 Miro Hrončok 2022-11-18 16:03:15 UTC
This is fixed upstream. We need to upgrade or patch.

Comment 7 Fedora Update System 2022-11-21 14:45:10 UTC
FEDORA-2022-a35ebecf5b has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-a35ebecf5b

Comment 8 Fedora Update System 2022-11-22 02:28:28 UTC
FEDORA-2022-a35ebecf5b has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-a35ebecf5b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-a35ebecf5b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2022-12-03 02:01:04 UTC
FEDORA-2022-a35ebecf5b has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.