Repository: ansible/molecule

Issue #4372: v25.1.0 cant find docker driver
Created: 2025-01-21T18:34:16Z
Prerequisites

 This was not already reported in the past (duplicate check)
 It does reproduce it with code from main branch (latest unreleased version)
 I include a minimal example for reproducing the bug
 The bug is not trivial, as for those a direct pull-request is preferred
 Running pip check does not report any conflicts
 I was able to reproduce the issue on a different machine
 The issue is not specific to any driver other than 'default' one

Environment
v25.1.0
(cannot get output, GH workflow)
What happened
Failed to load driver entry point Traceback (most recent call last):
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule/api.py", line 47, in drivers
    pm.load_setuptools_entrypoints("molecule.driver")
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule_plugins/containers/driver.py", line 23, in <module>
    from molecule_plugins.podman.driver import Podman as DriverBackend
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule_plugins/podman/driver.py", line 33, in <module>
    from molecule.util import run_command, sysexit_with_message
ImportError: cannot import name 'run_command' from 'molecule.util' (/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule/util.py)

ERROR    Failed to load driver entry point Traceback (most recent call last):
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule/api.py", line 47, in drivers
    pm.load_setuptools_entrypoints("molecule.driver")
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name, package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule_plugins/containers/driver.py", line 23, in <module>
    from molecule_plugins.podman.driver import Podman as DriverBackend
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule_plugins/podman/driver.py", line 33, in <module>
    from molecule.util import run_command, sysexit_with_message
ImportError: cannot import name 'run_command' from 'molecule.util' (/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule/util.py)

CRITICAL Failed to find driver docker. Please ensure that the driver is correctly installed.
Error: Process completed with exit code 1.

Reproducing example
Install molecule v25.1.0 and try run molecule test.

Example GH workflow:

      - uses: actions/checkout@v4

      - uses: mamba-org/setup-micromamba@v1
        with:
          micromamba-version: '1.5.8-0'
          environment-file: environment.ci.yml
          init-shell: bash
          post-cleanup: 'all'

      - name: Run Molecule tests
        run: molecule test
        shell: micromamba-shell {0}
        env:
          PY_COLORS: '1'
          ANSIBLE_FORCE_COLOR: '1'
          MOLECULE_DISTRO: ${{ matrix.distro }}


env files:

---
name: ansible-ufw
channels:
  - conda-forge
dependencies:
  - python~=3.12.0
  - pip>=22.2
  - pip:
      - -r requirements.txt
      - -r requirements.ci.txt



ansible-lint
molecule
molecule-plugins[docker]
docker
requests==2.31.0  # pinned to the latest version not breaking Docker SDK
yamllint

Duplicate issue #4374: v25.1.0 breaks `run_command` // cannot import name 'run_command' from 'molecule.util'
Created: 2025-01-22T09:40:33Z
Prerequisites

 This was not already reported in the past (duplicate check)
 It does reproduce it with code from main branch (latest unreleased version)
 I include a minimal example for reproducing the bug
 The bug is not trivial, as for those a direct pull-request is preferred
 Running pip check does not report any conflicts
 I was able to reproduce the issue on a different machine
 The issue is not specific to any driver other than 'default' one

Environment
Output of molecule --version
Failed to load driver entry point Traceback (most recent call last):
  File "/home/XXXXXXXXXXX/venv/lib/python3.13/site-packages/molecule/api.py", line 47, in drivers
    pm.load_setuptools_entrypoints("molecule.driver")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/home/XXXXXXXXXXX/venv/lib/python3.13/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/usr/lib/python3.13/importlib/metadata/__init__.py", line 179, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/XXXXXXXXXXX/venv/lib/python3.13/site-packages/molecule_plugins/podman/driver.py", line 33, in <module>
    from molecule.util import run_command, sysexit_with_message
ImportError: cannot import name 'run_command' from 'molecule.util' (/home/XXXXXXXXXXX/venv/lib/python3.13/site-packages/molecule/util.py)

molecule 25.1.0 using python 3.13 
    ansible:2.18.1
    containers:23.6.0 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1
    azure:23.6.0 from molecule_plugins
    gce:23.6.0 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0
    docker:23.6.0 from molecule_plugins requiring collections: community.docker>=3.4.11 ansible.posix>=1.4.0
    openstack:23.6.0 from molecule_plugins requiring collections: openstack.cloud>=2.1.0
    ec2:23.6.0 from molecule_plugins

What happened
v25.1.0 breaks integration with molecule-plugins[vagrant] (and probably more...)
Reproducing example
Just install molecule==25.1.0 and molecule-plugins==23.6.0 and type molecule --version

Closing comment (2025-01-22T09:45:36Z): imho, duplicate of #4372

Sorry, totally agree. This is just another driver but still the same issue.