Fails at TASK [Install Docker Compose using Pip.]
cipaterson opened this issue · comments
I'm on a Raspberry PI 4, "Raspbian GNU/Linux 12 (bookworm)".
Error is:
The license_file parameter is deprecated, use license_files instead
Googling, this seems to be because docker-compose has as requirement on pyyaml of <6,>=3.10 and it needs 6.0.1 or 3.5.1 to install successfully.
The basic problem seems to be the ansible task is installing docker-compose version 1 which has been deprecated.
I used
sudo apt install docker-compose
to install V2 manually and the ansible playbook then proceeded past the install docker-compose step OK.
What do people think - is my analysis correct? I am not certain.
This fix worked for me... Thanks!
This seems to be the full error:
manumaiden@manumaidenpi:~ $ pip install docker-compose
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.
For more information visit http://rptl.io/venv
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.
Which is coming from the docker.yml
task :
$ cat tasks/docker.yml | egrep Pip -A4
- name: Install Docker Compose using Pip.
ansible.builtin.pip:
name: docker-compose
state: present
executable: pip3
The solution could be to add docker-compose
to the list of the dependencies:
$ cat tasks/docker.yml | egrep '\(Debian' -A10
- name: Ensure dependencies are installed (Debian).
ansible.builtin.apt:
name:
- libffi-dev
- libssl-dev
- python3-dev
- python3-pip
- git
- rsync
- docker-compose
state: present
when: ansible_facts.os_family == "Debian"
But this will create a problem with the previous version of Debian (actually I am not sure if the docker-compose
can be installed via apt also on the previous version). So probably a condition to verify which distro is running on the target host could be considered:
$ ansible -m setup 192.168.88.3 | egrep distribution_version
"ansible_distribution_version": "12.2"
Sorry, I'm a bit lost.
I used
sudo apt install docker-compose
to install V2 manually and the ansible playbook then proceeded past the install docker-compose step OK.
How did you make this get you docker-compose
v2? The deprecation statement is written a little weird and seems to only provide hints in the context of docker desktop or "Moby".
I added the docker apt repo, but that doesn't show a package for docker-compose
newer than what raspbian (debian 12) ships with already.
pi@raspberrypi:~/internet-pi $ sudo apt-cache policy | grep dock
500 https://download.docker.com/linux/debian bookworm/stable arm64 Packages
origin download.docker.com
pi@raspberrypi:~/internet-pi $ apt search docker-compose
docker-compose/stable,stable 1.29.2-3 all
define and run multi-container Docker applications with YAML
...
Adding docker-compose to tasks/docker.yml
doesn't seem to prevent ansible from trying to install the python library.
Note that Compose V2 is a Go project, so it won’t be available as a Python library. Only Compose V1 is available via pip.
Which seems to say that there is no more python library starting with v2.
I have exact the same Problem.. Manually Install docker-compose also not works... same error:
fatal: [127.0.0.1]: 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 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"}
sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED
Then it works ;)
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.