internet-pi icon indicating copy to clipboard operation
internet-pi copied to clipboard

Error on: "Task: [Install Docker Compose using Pip]" - Fix here.

Open hockeygoalie35 opened this issue 1 year ago • 6 comments

Hi, so due to an issue with PyYAML5.4.1, the wheel for PyYAMLcan't be built. This is due to an issue with v5.4.1. This issue was apparenly caused by an incompatibility of PyYAML<6.0.1 compiled under the version of Cython>=3.0.

The Fix: Change docker.yml starting at line 52 in the Tasks folder:

name: Install Docker Compose using Pip.
  ansible.builtin.pip:
    name: 
      - pyyaml==5.3.1
      - docker-compose
    state: present
    executable: pip3

This ensures the previous version of PyYAML is pulled until 6.0.1 is released.

hockeygoalie35 avatar Oct 31 '23 00:10 hockeygoalie35

On Debian 12, the above change did not work until I also deleted the /usr/lib/python3.11/EXTERNALLY-MANAGED file.

tonythell avatar Nov 20 '23 01:11 tonythell

Hi, for me the error on that step was:

fatal: [172.16.1.142]: FAILED! => {"changed": false, "cmd": ["/usr/bin/pip3", "install", "pyyaml==5.3.1", "docker-compose"], "msg": "\n:stderr: error: externally-managed-environment\n\n× This environment is externally managed\n╰─> To install Python packages system-wide, try apt install\n python3-xyz, where xyz is the package you are trying to\n install.\n \n If you wish to install a non-Debian-packaged Python package,\n create a virtual environment using python3 -m venv path/to/venv.\n Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make\n sure you have python3-full installed.\n \n If you wish to install a non-Debian packaged Python application,\n it may be easiest to use pipx install xyz, which will manage a\n virtual environment for you. Make sure you have pipx installed.\n \n See /usr/share/doc/python3.11/README.venv for more information.\n\nnote: 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.\nhint: See PEP 668 for the detailed specification.\n"}

So I decided to be wild and pass --break-system-packages so the entries look like that now:

name: Install Docker Compose using Pip.
  ansible.builtin.pip:
    name: 
      - pyyaml==5.3.1
      - docker-compose
      - --break-system-packages
    state: present
    executable: pip3

It work!

PS: My Pi OS is Ubuntu Server 23.10

stevesirois avatar Nov 24 '23 14:11 stevesirois

This fixed the problem for me (Debian 12):

$ pip3 install "cython<3.0.0" wheel --break-system-packages
$ pip3 install pyyaml==5.4.1 --no-build-isolation  --break-system-packages
$ pip3 install docker-compose

explodeo avatar Nov 24 '23 19:11 explodeo

pip3 install docker-compose

Tried this for RPI5 but didn't work still get:

TASK [Install Docker Compose using Pip.] ********************************************************************************************************************************************************************************************************************************************************************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "cmd": ["/usr/bin/pip3", "install", "docker-compose"], "msg": "\n:stderr: error: externally-managed-environment\n\n× This environment is externally managed\n╰─> To install Python packages system-wide, try apt install\n python3-xyz, where xyz is the package you are trying to\n install.\n \n If you wish to install a non-Debian-packaged Python package,\n create a virtual environment using python3 -m venv path/to/venv.\n Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make\n sure you have python3-full installed.\n \n For more information visit http://rptl.io/venv\n\nnote: 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.\nhint: See PEP 668 for the detailed specification.\n"}

PLAY RECAP **************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** localhost : ok=6 changed=0 unreachable=0 failed=1 skipped=4 rescued=0 ignored=0

danindiana avatar Dec 20 '23 18:12 danindiana

@danindiana - Please see: https://www.jeffgeerling.com/blog/2023/how-solve-error-externally-managed-environment-when-installing-pip3

geerlingguy avatar Dec 20 '23 23:12 geerlingguy

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

github-actions[bot] avatar Apr 22 '24 21:04 github-actions[bot]

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

github-actions[bot] avatar Jun 24 '24 21:06 github-actions[bot]