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

Upgrade edge case #117

Open
compscidr opened this issue Aug 11, 2022 · 9 comments
Open

Upgrade edge case #117

compscidr opened this issue Aug 11, 2022 · 9 comments

Comments

@compscidr
Copy link

Kind of an edge case, so feel free to close.

I've been using this with ubuntu 22.04 on some other machines on fresh installs and it seems to work pretty well (even though I know its not listed as supported).

I have another machine which I did an upgrade from 20.04, and when it ran the Install Python packages it fails (it seems because it still had the old virtualenv there.

This was the sort error I saw:

failed: [ubuntu-desktop-beast] (item={'name': 'docker', 'state': 'present'}) => {"ansible_loop_var": "item", "changed": false, "cmd": ["/usr/local/lib/docker/virtualenv/bin/pip3", "install", "docker"], "item": {"name": "docker", "state": "present"}, "msg": "\n:stderr: Traceback (most recent call last):\n  File \"/usr/local/lib/docker/virtualenv/bin/pip3\", line 5, in <module>\n    from pip._internal.cli.main import main\nModuleNotFoundError: No module named 'pip'\n"}
failed: [ubuntu-desktop-beast] (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, "cmd": ["/usr/local/lib/docker/virtualenv/bin/pip3", "install", "docker-compose"], "item": {"name": "docker-compose", "path": "/usr/local/bin/docker-compose", "src": "/usr/local/lib/docker/virtualenv/bin/docker-compose", "state": "present", "version": ""}, "msg": "\n:stderr: Traceback (most recent call last):\n  File \"/usr/local/lib/docker/virtualenv/bin/pip3\", line 5, in <module>\n    from pip._internal.cli.main import main\nModuleNotFoundError: No module named 'pip'\n"}

Fixed it by just clobbering the virtualenv with sudo rm -rf /usr/local/lib/docker/virtualenv and now everything is happy.

Just thought I'd let you know in case you have any ideas on detecting and deadling with this edge case. Also appreciate this project!

@nickjj
Copy link
Owner

nickjj commented Aug 11, 2022

Hi,

Thanks. You mentioned it worked pretty well on 22.04, did it work out of the box with no adjustments on the fresh install?

I'm kind of surprised upgrading would cause that issue or if it's worth trying to find a workaround especially with Docker now installing Docker Compose through its official apt plugin which no longer requires a Python runtime or a virtualenv to be created. Your workaround seems good for the 1 off case. Did this happen every time you upgraded, just once out of X times or only once in the one time you tried it?

@compscidr
Copy link
Author

I think from a fresh install it works fine, I'll double check and report back.

Also, have a couple other machines that also need to be upgraded, will do those this evening and again let you know.

@compscidr
Copy link
Author

Confirmed on another machine I upgraded that the same issue is occurring, also confirmed that a fresh install works fine.

@nickjj
Copy link
Owner

nickjj commented Aug 26, 2022

Thanks. I wonder why it's picky about not being able to keep that file between upgrades. I am seeing in 22.04 it does work out of the box. Upgrading from 20.04 is kind of edge case'ish but if we can do something easily to address it I'm ok with supporting it. Any suggestions?

@compscidr
Copy link
Author

Sorry, got busy for a few weeks there.

Perhaps we could have a handler for the failure case which clobbers that folder or something? I'm not sure if there's a case though where we wouldn't want it to do that. I can give it a try and make a PR when I get a chance.

@daniel-sc
Copy link

For me, the problem that it used some virtualenv python to install pip docker (instead of the regular ansible python) happened with a fresh Ubuntu 22.04 using Ansible 6.3.0

@nickjj
Copy link
Owner

nickjj commented Jul 5, 2023

https://github.com/nickjj/ansible-docker#configuring-virtualenv explains why a virtualenv is used for anything that gets pip installed, that's the intended behavior.

@votti
Copy link

votti commented Apr 2, 2024

I also experienced the same issue after upgrading to Ubuntu 22.04`- the removing of the virtualenv fixed the issue.

@compscidr
Copy link
Author

Seems like this issue is also present after upgrade from 22.04 -> 24.04, removing the venv still fixes the issue though.

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

No branches or pull requests

4 participants