Repository navigation
Description
The de-duplicating sys.path PR #1248 seems to break "local" installations of mitogen into a custom folder.
Consider installing mitogen without pip, either with git clone or downloading and extracting the release tar into /custom/path/to/mitogen.
Then take any minimal Ansible playbook and adapt ansible.cfg to use that mitogen, as explained in the official docs.
[defaults]
strategy_plugins = /custom/path/to/mitogen/ansible_mitogen/plugins/strategy
strategy = mitogen_linearAnsible fails to correctly import the mitogen modules:
ansible-playbook -i inventory playbook.yml
PLAY [all] ******************************************************************************************************************
[ERROR]: Unexpected Exception, this is probably a bug: No module named 'ansible_mitogen'
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.14/site-packages/ansible/cli/__init__.py", line 660, in cli_executor
exit_code = cli.run()
File "/opt/homebrew/lib/python3.14/site-packages/ansible/cli/playbook.py", line 153, in run
results = pbex.run()
File "/opt/homebrew/lib/python3.14/site-packages/ansible/executor/playbook_executor.py", line 188, in run
result = self._tqm.run(play=play)
File "/opt/homebrew/lib/python3.14/site-packages/ansible/executor/task_queue_manager.py", line 320, in run
strategy = strategy_loader.get(new_play.strategy, self)
File "/opt/homebrew/lib/python3.14/site-packages/ansible/plugins/loader.py", line 979, in get
ctx = self.get_with_context(name, *args, **kwargs)
File "/opt/homebrew/lib/python3.14/site-packages/ansible/plugins/loader.py", line 1024, in get_with_context
self._module_cache[path] = self._load_module_source(python_module_name=plugin_load_context._python_module_name, path=path)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.14/site-packages/ansible/plugins/loader.py", line 943, in _load_module_source
spec.loader.exec_module(module)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "<frozen importlib._bootstrap_external>", line 762, in exec_module
File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed
File "/custom/path/to/mitogen/ansible_mitogen/plugins/strategy/mitogen_linear.py", line 48, in <module>
import ansible_mitogen.loaders
ModuleNotFoundError: No module named 'ansible_mitogen'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.14/site-packages/ansible/cli/__init__.py", line 669, in cli_executor
raise AnsibleError("Unexpected Exception, this is probably a bug.") from ex
ansible.errors.AnsibleError: Unexpected Exception, this is probably a bug: No module named 'ansible_mitogen'Reverting the commit 6145508 for only the file ansible_mitogen/plugins/strategy/mitogen_linear.py already fixes this import error (and successfully runs the minimal playbook).
Also note that a pip install mitogen installation is not affected by this regression. For instance using strategy_plugins = .venv/lib/python3.14/site-packages/ansible_mitogen/plugins/strategy works without issues.
Versions used:
python 3.14.0
ansible 12.1.0
ansible-core 2.19.3
Activity
moreati commentedon Oct 31, 2025
D'oh! Sorry for that. Please use 0.3.29 for now. It may be a week or so before I can get a fix out
moreati commentedon Nov 5, 2025
Please try 85069b2, if it works for you then I'll put out a new release.
upekkha commentedon Nov 5, 2025
Thanks. Yes that commit fixes the problems.
moreati commentedon Nov 5, 2025
Fix released in https://github.com/mitogen-hq/mitogen/releases/tag/v0.3.31