How to ensure consistent `pipx` environment?

I’m trying to use ansible-lint in my actions and the tool requires ansible. I inject the former into the latter’s pipx environment to make sure the two are compatible, but it still appears to fail periodically. How would I go about making sure that the two versions are always the same, without pinning to a specific version that’s bound to get old and will need a periodic refresh?

Installation:

+ pipx install --force ansible-lint
done! ✨ 🌟 ✨
creating virtual environment...
installing ansible-lint...
  installed package ansible-lint 5.2.1, Python 3.8.10
  These apps are now globally available
    - ansible-lint
+ pipx inject ansible-lint ansible
done! ✨ 🌟 ✨
installing ansible...
  injected package ansible into venv ansible-lint

The actual error:

+ ansible-lint -x var-naming ansible/
ERROR    FATAL: Ansible CLI (2.11.6) and python module (2.12.0) versions do not match. This indicates a broken execution environment.
Error: Process completed with exit code 4.

Thanks,
Piotr