nickjj / ansible-docker

Install / Configure Docker and Docker Compose using Ansible.
MIT License
750 stars 224 forks source link

Unable to find pip in the virtualenv #120

Closed klodoma closed 2 years ago

klodoma commented 2 years ago

I tried this package out, but on one of the servers I am getting this error:

failed: [*******] (item={'name': 'docker', 'state': 'present'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "docker", "state": "present"}, "msg": "Unable to find pip in the virtualenv, /usr/local/lib/docker/virtualenv, under any of these names: pip3, pip. Make sure pip is present in the virtualenv."}

I tried deleting /usr/local/lib/docker/virtualenv but it didn't helped.

failed: [*******] (item={'name': 'docker-compose', 'version': '', 'path': '/usr/local/bin/docker-compose', 'src': '/usr/local/lib/docker/virtualenv/bin/docker-compose', 'state': 'present'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "docker-compose", "path": "/usr/local/bin/docker-compose", "src": "/usr/local/lib/docker/virtualenv/bin/docker-compose", "state": "present", "version": ""}, "msg": "Unable to find pip in the virtualenv, /usr/local/lib/docker/virtualenv, under any of these names: pip3, pip. Make sure pip is present in the virtualenv."}

The server is running on Ubuntu 22

nickjj commented 2 years ago

You mentioned "one of the servers". Did it work on others?

Did you apt install python3 before using this role? That would be a standard thing to do on any server before using Ansible.

I've set up a few Ubuntu 22.04 servers on different hosts (including the stock ISO) with this role recently and everything worked.

klodoma commented 2 years ago

Yes, I have 2 servers for this use-case. On one is working on the other I get this error. Not sure where to start with the debugging :)

python3 is installed.

nickjj commented 2 years ago

Did you upgrade one from Ubuntu 20.04 to 22.04 where as the other is freshly 22.04?

klodoma commented 2 years ago

Did you upgrade one from Ubuntu 20.04 to 22.04 where as the other is freshly 22.04?

Both are new installations, no upgrades.

One is a plain ubuntu installations(on this one worked). The other(this one failed) came with PLESK admin interface which already installs quite some stuff on it so that might interfere a bit. Why it fails, beats me at this moment.

nickjj commented 2 years ago

I never used PLESK but it might be worth checking into their docs or Google on why it would make pip3 unavailable. Did you set your Ansible Python interpreter to python3, that would be necessary if your system has both Python 2 and Python 3 installed.

klodoma commented 2 years ago

pip3 is present.

Maybe this screenshot helps?

image

nickjj commented 2 years ago

pip3 is present.

It's not a matter of being present or not. Did you set your Ansible Python interpreter with this ansible.cfg modification?

[defaults]
ansible_python_interpreter = /usr/bin/python3
klodoma commented 2 years ago

I'll give up on this. These are test setups, maybe on the one that fails too much was changed already. I'll reinstall everything and see how that goes. Closing this for the moment.