Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable pip version check #1001

Merged
merged 1 commit into from
Nov 15, 2022

Conversation

mboersma
Copy link
Contributor

@mboersma mboersma commented Oct 19, 2022

What this PR does / why we need it:

Disables pip3's behavior of automatically checking online whether it has a new version available. For some reason, this check fails in our CI environment.

Previously
Trying to fix an error that popped up in the pull-azure-sigs job. May have to do with pip or other packages being updated but not pinned in this project.

+ WRAPPED_COMMAND_PID=17
+ ./images/capi/scripts/ci-azure-e2e.sh
+ wait 17
hack/ensure-ansible.sh
Collecting ansible-core==2.11.5
  Downloading ansible-core-2.11.5.tar.gz (6.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.8/6.8 MB 45.4 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting jinja2
  Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 kB 16.1 MB/s eta 0:00:00
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from ansible-core==2.11.5) (3.13)
Collecting cryptography
  Downloading cryptography-38.0.1-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 77.6 MB/s eta 0:00:00
Collecting packaging
  Downloading packaging-21.3-py3-none-any.whl (40 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.8/40.8 kB 5.6 MB/s eta 0:00:00
Collecting resolvelib<0.6.0,>=0.5.3
  Downloading resolvelib-0.5.4-py2.py3-none-any.whl (12 kB)
Collecting cffi>=1.12
  Downloading cffi-1.15.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (427 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 427.9/427.9 kB 37.8 MB/s eta 0:00:00
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting pyparsing!=3.0.5,>=2.0.2
  Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.3/98.3 kB 13.5 MB/s eta 0:00:00
Collecting pycparser
  Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 kB 14.1 MB/s eta 0:00:00
Building wheels for collected packages: ansible-core
  Building wheel for ansible-core (setup.py): started
  Building wheel for ansible-core (setup.py): finished with status 'done'
  Created wheel for ansible-core: filename=ansible_core-2.11.5-py3-none-any.whl size=1958072 sha256=9c3c18d0aea7495ea936af593ee74016d8e57ef9f82b9aa16159928349bddb02
  Stored in directory: /root/.cache/pip/wheels/85/5b/29/6265f34d09573e9db339824a7fdfcbc54dea5f7868322855db
Successfully built ansible-core
Installing collected packages: resolvelib, pyparsing, pycparser, MarkupSafe, packaging, jinja2, cffi, cryptography, ansible-core
Successfully installed MarkupSafe-2.1.1 ansible-core-2.11.5 cffi-1.15.1 cryptography-38.0.1 jinja2-3.1.2 packaging-21.3 pycparser-2.21 pyparsing-3.0.9 resolvelib-0.5.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/logging.py", line 177, in emit
    self.console.print(renderable, overflow="ignore", crop=False, style=style)
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/rich/console.py", line 1673, in print
    extend(render(renderable, render_options))
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/rich/console.py", line 1305, in render
    for render_output in iter_render:
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
    for line in lines:
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/rich/segment.py", line 249, in split_lines
    for segment in segments:
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/rich/console.py", line 1283, in render
    renderable = rich_cast(renderable)
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
    renderable = cast_method()
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
    pip_cmd = get_best_invocation_for_this_pip()
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/entrypoints.py", line 60, in get_best_invocation_for_this_pip
    os.path.join(binary_prefix, exe_name),
  File "/usr/lib/python3.7/genericpath.py", line 97, in samefile
    s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip3.7'
Call stack:
  File "/usr/local/bin/pip3", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/base_command.py", line 223, in _main
    self.handle_pip_version_check(options)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/req_command.py", line 190, in handle_pip_version_check
    pip_self_version_check(session, options)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/self_outdated_check.py", line 236, in pip_self_version_check
    logger.warning("[present-rich] %s", upgrade_prompt)
  File "/usr/lib/python3.7/logging/__init__.py", line 1395, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "/usr/lib/python3.7/logging/__init__.py", line 1519, in _log
    self.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1529, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1591, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 905, in handle
    self.emit(record)
  File "/usr/local/lib/python3.7/dist-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'),)
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the 
controller starting with Ansible 2.12. Current version: 3.7.3 (default, Jan 22 
2021, 20:04:44) [GCC 8.3.0]. This feature will be removed from ansible-core in 
version 2.12. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.

Which issue(s) this PR fixes:

Fixes #

Additional context

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 19, 2022
@mboersma
Copy link
Contributor Author

/retitle [WIP] Fix pip error building Azure images

@k8s-ci-robot k8s-ci-robot changed the title Fix pip error building Azure images [WIP] Fix pip error building Azure images Oct 19, 2022
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 19, 2022
@mboersma
Copy link
Contributor Author

/test pull-azure-sigs

1 similar comment
@mboersma
Copy link
Contributor Author

/test pull-azure-sigs

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 19, 2022
@mboersma mboersma force-pushed the fix-azure-pip-error branch from 86545fc to 4fa97a4 Compare October 19, 2022 16:20
@mboersma
Copy link
Contributor Author

/retitle Disable pip version check

@k8s-ci-robot k8s-ci-robot changed the title [WIP] Fix pip error building Azure images Disable pip version check Oct 19, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 19, 2022
@mboersma
Copy link
Contributor Author

/test pull-azure-sigs

1 similar comment
@mboersma
Copy link
Contributor Author

/test pull-azure-sigs

@mboersma
Copy link
Contributor Author

/assign @CecileRobertMichon @marosset

@mboersma
Copy link
Contributor Author

Flatcar failed to build, seems unrelated:

�[1;32m==> sig-flatcar:  -> ResourceGroupName : 'pkr-Resource-Group-5b1now1lgu'�[0m
�[1;32m==> sig-flatcar:  -> DeploymentName    : 'pkrdp5b1now1lgu'�[0m
�[1;32m==> sig-flatcar: ERROR: -> InvalidTemplateDeployment : The template deployment 'pkrdp5b1now1lgu' is not valid according to the validation procedure. The tracking id is '84a56716-1468-4251-9488-417344a34f96'. See inner errors for details.
==> sig-flatcar: ERROR:   -> InvalidParameter : The following list of images referenced from the deployment template are not found: Publisher: kinvolk, Offer: flatcar-container-linux-free, Sku: stable, Version: 3227.2.3. Please refer to https://docs.microsoft.com/en-us/azure/virtual-machines/windows/cli-ps-findimage for instructions on finding available images.

@mboersma mboersma force-pushed the fix-azure-pip-error branch from 4fa97a4 to 235bfe8 Compare October 19, 2022 18:41
@mboersma
Copy link
Contributor Author

Refactored to use environment variable toggles instead, and to silence the warning about running as root.

@mboersma
Copy link
Contributor Author

/test pull-azure-sigs

@CecileRobertMichon
Copy link
Contributor

related to #958? cc @kkeshavamurthy

@mboersma
Copy link
Contributor Author

I don't think it's directly related. pip install and pip show have always checked to see if there's a new version by default, which has only been an annoyance in the past.
But version 22.3 was published a few days ago, and for some reason printing the "you should upgrade" message itself fails. I think that could have happened even if we hadn't been upgrading pip.

@CecileRobertMichon
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 19, 2022
@mboersma
Copy link
Contributor Author

Flatcar failed again, same error as above. cc: @johananl @kopiczko @invidian

@invidian
Copy link
Member

Flatcar failed again, same error as above. cc: @johananl @kopiczko @invidian

Thanks for letting us know. This error seem new. I'll have a look.

@invidian
Copy link
Member

Created #1002.

@mboersma
Copy link
Contributor Author

/test pull-azure-sigs

@jsturtevant
Copy link
Contributor

this might finally fix #766 ? 🙏

What version of Pip do we end up with? The version tied to the python installed?

@mboersma
Copy link
Contributor Author

What version of Pip do we end up with?

AFAICT we use the pip binary installed by the package manager to install pip with --user. We refer to the new user-installed tool consistently as pip3 and upgrade it if necessary in an azure-cli setup task.

Upgrading pip seems fine, it was just the "check for a new pip" behavior that was crashing. That also resolved itself, so I assume the implementation fetched something dynamically (a reStructuredText template perhaps?) and that we weren't alone in seeing this problem.

So this change isn't strictly necessary right now since pip seems to have fixed its upgrade check behavior (and Flatcar's version discrepancy isn't happening). Probably still a good idea though.

@jsturtevant
Copy link
Contributor

So this change isn't strictly necessary right now since pip seems to have fixed its upgrade check behavior

Thanks for the details. I think it is likely still required since this seems to happen periodically (maybe there is some type of lag when pip upgrades?) This will prevent it from happening again and make the behavior more detministic since we control the pip version.

/lgtm

Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mboersma do we still want this?

@mboersma
Copy link
Contributor Author

@CecileRobertMichon yes, I think it's a worthwhile change that would prevent a similar problem in the future.

@CecileRobertMichon
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon, mboersma

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 15, 2022
@k8s-ci-robot k8s-ci-robot merged commit 563c3ae into kubernetes-sigs:master Nov 15, 2022
@mboersma mboersma deleted the fix-azure-pip-error branch December 10, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants