Skip to content

No module named 'molecule' #59

Open
@fooock

Description

I'm trying to run molecule-vagrant in my project but I get this error: ModuleNotFoundError: No module named 'molecule'.

I'm using:

$ python -V
Python 3.8.9

The installed packages in my virtual environment:

$ pip freeze
ansible-compat==2.2.0
arrow==1.2.2
attrs==21.4.0
binaryornot==0.4.4
Cerberus==1.3.2
certifi==2022.6.15
chardet==5.0.0
charset-normalizer==2.1.0
click==8.1.3
click-help-colors==0.9.1
commonmark==0.9.1
cookiecutter==2.1.1
distro==1.7.0
enrich==1.2.7
idna==3.3
importlib-resources==5.9.0
Jinja2==3.1.2
jinja2-time==0.2.0
jsonschema==4.7.2
MarkupSafe==2.1.1
molecule==4.0.1
molecule-vagrant==1.0.0
packaging==21.3
pluggy==1.0.0
Pygments==2.12.0
pyparsing==3.0.9
pyrsistent==0.18.1
python-dateutil==2.8.2
python-slugify==6.1.2
python-vagrant==1.0.0
PyYAML==6.0
requests==2.28.1
rich==12.5.1
selinux==0.2.1
six==1.16.0
subprocess-tee==0.3.5
text-unidecode==1.3
typing-extensions==4.3.0
urllib3==1.26.10
zipp==3.8.1

As you can see, I have molecule and molecule-vagrant installed.

The Vagrant version I'm using:

$ vagrant version
Installed Version: 2.2.19
Latest Version: 2.2.19

Running molecule converge -s vagrant results in this error:

$ molecule converge -s vagrant
INFO     vagrant scenario test matrix: dependency, create, prepare, converge
INFO     Performing prerun with role_name_check=0...
INFO     Set ANSIBLE_LIBRARY=/Users/javi/.cache/ansible-compat/ee13aa/modules:/Users/javi/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/Users/javi/.cache/ansible-compat/ee13aa/collections:/Users/javi/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/Users/javi/.cache/ansible-compat/ee13aa/roles:/Users/javi/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Using /Users/javi/.cache/ansible-compat/ee13aa/roles/yourbtc.bitcoin_core symlink to current repository in order to enable Ansible to find the role using its expected full name.
INFO     Running vagrant > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running vagrant > create

PLAY [Create] ******************************************************************

TASK [Create molecule instance(s)] *********************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'molecule'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/Users/javi/.ansible/tmp/ansible-tmp-1658674349.230397-55949-146925441104677/AnsiballZ_vagrant.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/Users/javi/.ansible/tmp/ansible-tmp-1658674349.230397-55949-146925441104677/AnsiballZ_vagrant.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/Users/javi/.ansible/tmp/ansible-tmp-1658674349.230397-55949-146925441104677/AnsiballZ_vagrant.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.vagrant', init_globals=dict(_module_fqn='ansible.modules.vagrant', _modlib_path=modlib_path),\n  File \"/usr/local/Cellar/[email protected]/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py\", line 224, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/local/Cellar/[email protected]/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py\", line 96, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/local/Cellar/[email protected]/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/var/folders/gf/fn91_brj0dl9jm46x9q1xs7r0000gn/T/ansible_vagrant_payload_kx2mnr9g/ansible_vagrant_payload.zip/ansible/modules/vagrant.py\", line 37, in <module>\nModuleNotFoundError: No module named 'molecule'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

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

WARNING  Retrying execution failure 2 of: ansible-playbook --inventory /Users/javi/.cache/molecule/bitcoin-core-role/vagrant/inventory --skip-tags molecule-notest,notest /Users/javi/projects/yourbtc.link/yourbtc-ansible/bitcoin-core-role/molecule/vagrant/venv/lib/python3.8/site-packages/molecule_vagrant/playbooks/create.yml
CRITICAL Ansible return code was 2, command was: ['ansible-playbook', '--inventory', '/Users/javi/.cache/molecule/bitcoin-core-role/vagrant/inventory', '--skip-tags', 'molecule-notest,notest', '/Users/javi/projects/yourbtc.link/yourbtc-ansible/bitcoin-core-role/molecule/vagrant/venv/lib/python3.8/site-packages/molecule_vagrant/playbooks/create.yml']

Any idea on what is happening?? If you want to test it, my project branch is here

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions