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

molecule does not find docker within pipx venv #2489

Closed
stefangweichinger opened this issue Jan 13, 2020 · 5 comments
Closed

molecule does not find docker within pipx venv #2489

stefangweichinger opened this issue Jan 13, 2020 · 5 comments
Labels

Comments

@stefangweichinger
Copy link

Issue Type

  • Bug report

Molecule and Ansible details

pipx list
venvs are in /home/sgw/.local/pipx/venvs
apps are exposed on your $PATH at /home/sgw/.local/bin
   package ansible 2.9.2, Python 3.7.6
    - ansible
    - ansible-config
    - ansible-connection
    - ansible-console
    - ansible-doc
    - ansible-galaxy
    - ansible-inventory
    - ansible-playbook
    - ansible-pull
    - ansible-test
    - ansible-vault
   package debops 1.2.1, Python 3.7.6
    - debops
    - debops-defaults
    - debops-init
    - debops-padlock
    - debops-task
    - debops-update
   package docker 4.1.0, Python 3.7.6
    - chardetect
    - wsdump.py
   package molecule 2.22, Python 3.7.6
    - molecule

Molecule installation method (one of):

  • pipx

Ansible installation method (one of):

  • pipx

Detail any linters or test runners used:

Desired Behavior

molecule should correctly create/destroy/converge docker containers.
It does so if I use my old python venv, but not with the environment created with pipx.

Actual Behaviour

molecule --debug destroy
--> Validating schema /home/sgw/projects/github/xyx/molecule/default/molecule.yml.
Validation completed successfully.
--> Validating schema /home/sgw/projects/github/xyx/molecule/travis/molecule.yml.
Validation completed successfully.
--> Test matrix
    
└── default
    ├── dependency
    ├── cleanup
    └── destroy
    
--> Scenario: 'default'
--> Action: 'dependency'
Skipping, missing the requirements file.
--> Scenario: 'default'
--> Action: 'cleanup'
Skipping, cleanup playbook not configured.
--> Scenario: 'default'
--> Action: 'destroy'
--> Sanity checks: 'docker'
ERROR: Missing Docker driver dependency. Please install via 'molecule[docker]' or refer to your INSTALL.rst driver documentation file
@stefangweichinger
Copy link
Author

Additional:

pipx https://github.com/pipxproject/pipx

was installed like recommended:

python3 -m pip install --user pipx
python3 -m pipx ensurepath

After that:

pipx install molecule
pipx install docker

@zeitounator
Copy link
Contributor

zeitounator commented Jan 13, 2020

You just made me discover pipx that I didn't know so thanks for that.

The problem is not with molecule but with your usage of pipx.

Very briefly reading your ticket and the doc. It looks like ansible runs in its own pipx venv which does not have the docker lib installed. There is a pipx inject command that will let you inject a package in an existing pipx venv. This is what you have to use. Note you may need this for other libraries like e.g. jmespath (if you use json_query)...

@stefangweichinger
Copy link
Author

@zeitounator (oh, a climber pic .. climber here as well ;-) )

I tried some inject commands and now it seems to work.
I will start over to get a clean environment.

pipx list

does not list the injected packages, btw

But it seems OK now, thanks.
This makes using topgrade even more useful

@ssbarnea
Copy link
Member

pipx is not a supported but if you make a PR that fixes your pipx issue without breaking anything else, I will be happy to review it.

@hswong3i
Copy link
Contributor

hswong3i commented Mar 3, 2021

Install Molecule could be done with pipx install and pipx inject, e.g.:

pipx install --include-deps flake8
pipx install --include-deps yamllint
pipx install --include-deps ansible
pipx inject --include-apps ansible ansible-lint
pipx inject --include-apps ansible molecule
pipx inject ansible docker
pipx inject ansible openshift
pipx inject ansible python-vagrant
pipx inject ansible netaddr
pipx inject ansible molecule-docker
pipx inject ansible molecule-podman
pipx inject ansible molecule-vagrant

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

No branches or pull requests

4 participants