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

Fix breaking Python image #15

Merged
merged 1 commit into from
Aug 9, 2023
Merged

Fix breaking Python image #15

merged 1 commit into from
Aug 9, 2023

Conversation

peterdeme
Copy link
Contributor

@peterdeme peterdeme commented Aug 7, 2023

Description of the change

Python/pip doesn't like to install packages globally anymore. Apparently, you need to provide a new argument since Py 3.11.

Type of change

  • Bug fix (non-breaking change that fixes an issue);
  • New feature (non-breaking change that adds functionality);
  • Breaking change (fix or feature that would cause existing functionality to not work as expected);
  • Documentation (change not affecting any of the images);

Checklists

Development

  • The affected image builds in your local environment;

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached;
  • This pull request is no longer marked as "draft";
  • Reviewers have been assigned;
  • Changes have been reviewed by at least one other engineer;

Copy link

@adamconnelly adamconnelly left a comment

Choose a reason for hiding this comment

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

Is this definitely a safe approach? I'm not super clued up on Python, but since this isn't just a throw away container that's used for CI, I'm wondering if we should pay attention to the error and not try to install the tools that are managed by APT via pip.

@peterdeme
Copy link
Contributor Author

@adamconnelly

not try to install the tools that are managed by APT via pip.

These are python packages. Don't think they're managed by apt. I think the reason it complains is that we don't use virtualenvs but install it globally. In this case, it's fine, we want to.

@adamconnelly
Copy link

@adamconnelly

not try to install the tools that are managed by APT via pip.

These are python packages. Don't think they're managed by apt. I think the reason it complains is that we don't use virtualenvs but install it globally. In this case, it's fine, we want to.

The reason I was asking was because I did some skimming this morning, and it sounded like the reason they introduced this behaviour was to avoid conflicts between pip and OS level package managers (here's the full design doc: https://peps.python.org/pep-0668/).

There's an article explaining how to solve the issue here, and the first option it provides is to install the Python package that is causing an issue with apt instead of pip.

I get your point that it's fine to install the packages globally because this is a docker image, but the reason I'm asking the question is that I don't think Don't think they're managed by apt is correct, because as far as I understand it this error is explicitly caused by trying to install/update a Python package that's managed by apt.

Again, maybe that's fine, but just wanting to double check since we're explicitly working against something that's meant to protect against problems here. At the least I think we need to add a comment explaining why we had to add this flag, and why it's ok in this circumstance.

@peterdeme peterdeme force-pushed the peterdeme-patch-1 branch 2 times, most recently from f6868f7 to a10f550 Compare August 8, 2023 11:24
@peterdeme
Copy link
Contributor Author

@adamconnelly

@peterdeme peterdeme changed the title Add --break-system-packages flag to Python image Fix breaking Python image Aug 8, 2023
Copy link

@adamconnelly adamconnelly left a comment

Choose a reason for hiding this comment

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

LGTM

@peterdeme peterdeme merged commit fd09131 into main Aug 9, 2023
8 checks passed
@peterdeme peterdeme deleted the peterdeme-patch-1 branch August 9, 2023 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants