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

builtins.ModuleNotFoundError: '_ctypes' is present in the Mitogen importer blacklist, ... #1196

Open
guangyi330 opened this issue Nov 25, 2024 · 3 comments
Labels
affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome

Comments

@guangyi330
Copy link

guangyi330 commented Nov 25, 2024

Controller

ansible [core 2.17.6]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0] (/usr/bin/python3.10)
  jinja version = 3.1.4
  libyaml = True

root@melody-virtual-machine:/home/melody/Documents/test# ansible-config dump --only-changed
CONFIG_FILE() = /etc/ansible/ansible.cfg
DEFAULT_STRATEGY(/etc/ansible/ansible.cfg) = mitogen_linear
DEFAULT_STRATEGY_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/usr/local/lib/python3.10/dist-packages/ansible_mitogen/plugins/strategy']
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = /usr/bin/python3.10

root@melody-virtual-machine:/home/melody/Documents/test# python3 --version
Python 3.10.12

root@melody-virtual-machine:/home/melody/Documents/test# pip show mitogen
Name: mitogen
Version: 0.3.18
Summary: Library for writing distributed self-replicating programs.
Home-page: https://github.com/mitogen-hq/mitogen/
Author: David Wilson
Author-email: 
License: New BSD
Location: /usr/local/lib/python3.10/dist-packages
Requires: 
Required-by: 

virtual-machine:/home/melody/Documents/test# uname -a
Linux melody-virtual-machine 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

target os

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

target python:

[root@localhost ~]# python3 --version
Python 3.10.15

when i run the command

ansible-playbook app_deploy.yml

PLAY [all] ***********************************************************************************************************************************************************************************************************************************

TASK [Include Python3 installation playbook] *************************************************************************************************************************************************************************************************
included: /home/melody/Documents/test/python3_include_playbook.yml for 20.11.18.19

TASK [Set python interpreter] ****************************************************************************************************************************************************************************************************************
ok: [20.11.18.19] => (item=/usr/bin/python3)
skipping: [20.11.18.19] => (item=/usr/bin/python3.9) 
skipping: [20.11.18.19] => (item=/usr/bin/python3.10) 

TASK [Check if zlib is installed] ************************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was:   File "<stdin>", line 1544, in _refuse_imports
fatal: [20.11.18.19]: FAILED! => {"msg": "Unexpected failure during module execution: builtins.ModuleNotFoundError: '_ctypes' is present in the Mitogen importer blacklist, therefore this context will not attempt to request it from the master, as the request will always be refused.\n  File \"<stdin>\", line 3856, in _dispatch_one\n  File \"<stdin>\", line 3843, in _parse_request\n  File \"<stdin>\", line 710, in import_module\n  File \"<stdin>\", line 1668, in exec_module\n  File \"master:/usr/local/lib/python3.10/dist-packages/ansible_mitogen/target.py\", line 70, in <module>\n    import ansible_mitogen.runner\n  File \"<stdin>\", line 1668, in exec_module\n  File \"master:/usr/local/lib/python3.10/dist-packages/ansible_mitogen/runner.py\", line 43, in <module>\n    import ctypes\n  File \"/opt/python/3.10.15/lib/python3.10/ctypes/__init__.py\", line 8, in <module>\n    from _ctypes import Union, Structure, Array\n  File \"<stdin>\", line 1623, in create_module\n  File \"<stdin>\", line 1544, in _refuse_imports\n", "stdout": ""}
...ignoring

How can I solve this problem?

Edit 2024-12-02 by @moreati: Formatting

@guangyi330 guangyi330 added affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome labels Nov 25, 2024
@moreati moreati changed the title How to solve _ctypes problem builtins.ModuleNotFoundError: '_ctypes' is present in the Mitogen importer blacklist, ... Nov 27, 2024
@moreati
Copy link
Member

moreati commented Nov 27, 2024

see also #1103

@guangyi330
Copy link
Author

image

@moreati
Copy link
Member

moreati commented Dec 2, 2024

What are the contents of app_deploy.yml, and python3_include_playbook.yml up to and including the task "Check if zlib is installed"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome
Projects
None yet
Development

No branches or pull requests

2 participants