-
Notifications
You must be signed in to change notification settings - Fork 379
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
Update pip install to handle "error: externally-managed-environment" #1320
Update pip install to handle "error: externally-managed-environment" #1320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
Do you happen to know if the E2E environment changes were announced anywhere? Is there something we should be keeping an eye on for potential problems?
echo "$output" | ||
elif [[ $output == *"error: externally-managed-environment"* ]]; then | ||
>&2 echo "warning: externally-managed-environment, retrying pip3 install with --break-system-packages" | ||
pip3 install --disable-pip-version-check --user --break-system-packages "${@}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆
--break-system-packages
What a great flag name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appropriately scary-sounding.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AverageMarcus 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 |
I don't know for sure. It might just have been a global update to the I did a bit of research on why this is happening and determined it was better just to adapt to it. But I'll go look at #sig-testing and #prow and see if I can find a clue. |
What this PR does / why we need it:
Adds a new
pip3_install
bash function that will retry installation if a certain error is raised.Recently the e2e build environment was updated such that PEP 668 became implemented. This means that
pip3 install <package>
raises an error telling the user to doapt-get install python-<package>
instead. Here is one example of that failure.This makes sense for distro vendors, but image-builder doesn't control the distro and has specific requirements for some tools (Packer, ansible, ansible-lint).
Which issue(s) this PR fixes:
Fixes #
Additional context
I looked at the recommended approach–using a Python virtualenv–but it's not a great fit with our set of scripts and would require more significant refactoring.