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

Setting up tox on ubuntu-24.04 runners fails #82

Closed
jnsgruk opened this issue Sep 18, 2024 · 10 comments
Closed

Setting up tox on ubuntu-24.04 runners fails #82

jnsgruk opened this issue Sep 18, 2024 · 10 comments

Comments

@jnsgruk
Copy link
Contributor

jnsgruk commented Sep 18, 2024

Github recently released their ubuntu-24.04 series runners. Using those results in an error because actions-operator tries to install tox globally with pip, rather than in a virtual environment.

See example failure here: https://github.com/canonical/parca-k8s-operator/actions/runs/10922157328/job/30315898232

Run charmed-kubernetes/actions-operator@main
Install core snap
Install LXD
Initialize LXD
Install tox
  /usr/bin/which tox
  /usr/bin/which pip
  /usr/bin/pip
  pip is available, install tox
  /usr/bin/pip install tox
  error: externally-managed-environment
  
  × This environment is externally managed
  ╰─> To install Python packages system-wide, try apt install
      python3-xyz, where xyz is the package you are trying to
      install.
      
      If you wish to install a non-Debian-packaged Python package,
      create a virtual environment using python3 -m venv path/to/venv.
      Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
      sure you have python3-full installed.
      
      If you wish to install a non-Debian packaged Python application,
      it may be easiest to use pipx install xyz, which will manage a
      virtual environment for you. Make sure you have pipx installed.
      
      See /usr/share/doc/python3.[12](https://github.com/canonical/parca-k8s-operator/actions/runs/10918199388/job/30304336943#step:3:13)/README.venv for more information.
  
  note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
  hint: See PEP 668 for the detailed specification.
@jnsgruk
Copy link
Contributor Author

jnsgruk commented Sep 20, 2024

@addyess are you still a maintainer on this?

@addyess
Copy link
Member

addyess commented Sep 20, 2024

@jnsgruk aye...

i believe the actions-operator supports this by first using the setup-python action:

See #81

if you'll add a setup-python before actions-operator, then tox will install into that environment instead of the system-wide one

@jnsgruk
Copy link
Contributor Author

jnsgruk commented Sep 23, 2024

For anyone reading, I solved this in zinc-k8s like so:

@addyess
Copy link
Member

addyess commented Sep 23, 2024

@jnsgruk precisely. That's how it's expected to look

@jnsgruk
Copy link
Contributor Author

jnsgruk commented Sep 23, 2024

Hmm, seems the action is now stalled on setting up MicroK8s, though: https://github.com/jnsgruk/zinc-k8s-operator/actions/runs/10999695504/job/30540473863

@addyess
Copy link
Member

addyess commented Sep 24, 2024

@jnsgruk looking at sg -- maybe it now requires a password?

Mon, 23 Sep 2024 17:55:06 GMT   /usr/bin/bash -c sudo usermod -a -G snap_microk8s $USER
Mon, 23 Sep 2024 17:55:06 GMT   /usr/bin/sg snap_microk8s -c microk8s status --wait-ready --timeout=600
Mon, 23 Sep 2024 23:53:39 GMT   Password: 
Mon, 23 Sep 2024 23:53:39 GMT   Error: The operation was canceled.

This might take some time to sort out

@addyess
Copy link
Member

addyess commented Sep 24, 2024

I recreated your issue in the CI for this project:
https://github.com/charmed-kubernetes/actions-operator/actions/runs/11006467708/job/30560799999?pr=83

the same issue with sg occurs both for microk8s and lxd... in either case the github runner session can't seem to get past an interactive prompt from from sg requesting the password be entered

@jnsgruk
Copy link
Contributor Author

jnsgruk commented Sep 24, 2024

This seems to be an upstream issue, which is closed but not solved.

Looks like one of our colleagues solved this by replacing instances of sg GROUP with sudo -u $USER -E

@addyess
Copy link
Member

addyess commented Sep 24, 2024

Alright, that's applied but has ripples into pytest-operator

charmed-kubernetes/pytest-operator#139

@addyess
Copy link
Member

addyess commented Sep 24, 2024

@jnsgruk thanks for highlighting this need. #83 closes this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants