charmed-kubernetes / actions-operator

Apache License 2.0
5 stars 18 forks source link

Setting up `tox` on `ubuntu-24.04` runners fails #82

Open jnsgruk opened 3 days ago

jnsgruk commented 3 days ago

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 commented 1 day ago

@addyess are you still a maintainer on this?

addyess commented 1 day ago

@jnsgruk aye...

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

See https://github.com/charmed-kubernetes/actions-operator/pull/81

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