Installing libffi-dev and re-installing python3.7 fixed the problem for me.

to cleanly build py 3.7 libffi-dev is required or else later stuff will fail

If using RHEL/Fedora:

sudo yum install libffi-devel

or

sudo dnf install libffi-devel

If using Debian/Ubuntu:

sudo apt-get install libffi-dev
Answer from dotbit on Stack Overflow
🌐
GitHub
github.com › pythonnet › pythonnet › issues › 932
ImportError : No module named '_ctypes' · Issue #932 · pythonnet/pythonnet
August 4, 2019 - I have tried everything from uninstalling and reinstalling Python to modifying the ctypes/__init__.py file to try and import Ctypes directly to no effect. Having researched this topic online throughly I have found a number of suggestions which point to running yum install libffi-devel as detailed here. However this does not appear to be something that I can perform on windows given that yum appears to be a Linux only application.
Author: pythonnet
Discussions

az functionapp - fails with ModuleNotFoundError: No module named 'ctypes' in SAW
Describe the bug Not able to use any az functionapp command in my saw, always gets the ModuleNotFoundError: No module named 'ctypes' even after running the az alone in the terminal as the w... More on github.com
🌐 github.com
13
November 18, 2024
Pipenv lock : ModuleNotFoundError: No module named '_ctypes'
Locking [packages] dependencies... ... get_windows_console_stream File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click_winconsole.py", line 16, in import ctypes File "C:\Users\User\AppData\Local\Programs\Python\Python37\Lib\ctypes_init.py", line 7, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named ... More on github.com
🌐 github.com
1
December 26, 2021
ModuleNotFoundError: No module named '_ctypes_test' (Debugger on Windows)
Hello, I'm trying to run the debugger on Windows but I'm running into the following error when starting it: ModuleNotFoundError: No module named '_ctypes_test' Python is correctly i... More on github.com
🌐 github.com
3
August 11, 2024
Installing ctypes
ctypes comes preinstalled with python. Did you try using it and it didn't work? Paste the code and the full error message you are getting. More on reddit.com
🌐 r/learnpython
9
1
November 2, 2022
People also ask

Why does No module named _ctypes happen?
The Python interpreter was built without the _ctypes extension, often because libffi development support was missing during compilation or the wrong interpreter is running.
🌐
pythonpool.com
pythonpool.com › home › error › fix no module named _ctypes in python
[Solved] ModuleNotFounderror: No Module named _ctypes in ...
How do I check whether _ctypes is available?
Run a small import with the same Python executable used by the application and print sys.executable before changing environments.
🌐
pythonpool.com
pythonpool.com › home › error › fix no module named _ctypes in python
[Solved] ModuleNotFounderror: No Module named _ctypes in ...
Can reinstalling a package fix _ctypes?
Usually no. _ctypes is part of the Python build, so repair or replace the interpreter and its build dependencies rather than installing an unrelated package.
🌐
pythonpool.com
pythonpool.com › home › error › fix no module named _ctypes in python
[Solved] ModuleNotFounderror: No Module named _ctypes in ...
🌐
GitHub
github.com › Azure › azure-cli › issues › 30379
az functionapp - fails with ModuleNotFoundError: No module named 'ctypes' in SAW · Issue #30379 · Azure/azure-cli
November 18, 2024 - Here is the traceback: No module named 'ctypes' Traceback (most recent call last): File "C:\Users\VssAdministrator\AppData\Local\Temp\pip-target-6cbhvr91\lib\python\knack/cli.py", line 233, in invoke File "D:\a\1\s\build_scripts\windows\artifacts\Python\Lib\site-packages\azure/cli/core/commands/init.py", line 588, in execute File "C:\Users\VssAdministrator\AppData\Local\Temp\pip-target-6cbhvr91\lib\python\knack/parser.py", line 261, in parse_args File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\argparse.py", line 1870, in parse_args File "D:\a\1\s\build_scripts\windows\artifacts\Python\L
Author: Azure
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-modulenotfounderror-no-module-named-ctypes
How to Fix ModuleNotFoundError: No Module Named '_ctypes' - GeeksforGeeks
July 23, 2025 - When Python encounters the "ModuleNotFoundError: No module named '_ctypes'" error, it means that the '_ctypes' module is unavailable for a reason causing the interpreter to fail when trying to import it.
🌐
GitHub
github.com › pypa › pipenv › issues › 2822
Pipenv lock : ModuleNotFoundError: No module named '_ctypes' · Issue #2822 · pypa/pipenv
December 26, 2021 - Locking [packages] dependencies... ser\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 8, in from .types import convert_type, IntRange, BOOL File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\types.py", line 4, in from ._compat import open_stream, text_type, filename_to_ui, File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click_compat.py", line 536, in from ._winconsole import get_windows_console_stream File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click_winconsole.py", line 16, in import ctypes File "C:\Users\User\AppData\Local\Programs\Python\Python37\Lib\ctypes_init.py", line 7, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes'
Author: pypa
🌐
GitHub
github.com › NationalSecurityAgency › ghidra › issues › 6802
ModuleNotFoundError: No module named '_ctypes_test' (Debugger on Windows) · Issue #6802 · NationalSecurityAgency/ghidra
August 11, 2024 - Hello, I'm trying to run the debugger on Windows but I'm running into the following error when starting it: ModuleNotFoundError: No module named '_ctypes_test' Python is correctly installed with all dependencies mentioned in the help pag...
Author: NationalSecurityAgency
Find elsewhere
🌐
Python Pool
pythonpool.com › home › error › fix no module named _ctypes in python
[Solved] ModuleNotFounderror: No Module named _ctypes in ...
July 13, 2026 - Fix No module named _ctypes by checking the Python build, libffi development support, virtual environments, and interpreter selection.
🌐
RoseIndia
roseindia.net › answers › viewqa › pythonquestions › 67942-ModuleNotFoundError-No-module-named-ctypes.html
ModuleNotFoundError: No module named 'ctypes'
named 'ctypes-windows-sdk' How to remove the ModuleNotFoundError: No module..., ModuleNotFoundError: No module named 'ctypes-windows-sdk' error will be solved
🌐
Itsourcecode
itsourcecode.com › home › modulenotfounderror: no module named _ctypes [fixed]
Modulenotfounderror: no module named _ctypes [Fixed] (2026)
July 12, 2026 - Modulenotfounderror: no module named ctypes is an error raised when the libffi-dev package is missing in installation.
🌐
GitHub
github.com › mherrmann › fbs › issues › 19
ctypes.wintypes module not found · Issue #19 · mherrmann/ ...
May 31, 2018 - After building my App.exe on Windows using Python 3.6.5, I get this when I run it: Traceback (most recent call last): ... import ctypes, ctypes.wintypes ModuleNotFoundError: No module named 'ct...
Author: mherrmann
🌐
Delft Stack
delftstack.com › home › howto › python › modulenotfounderror no module named _ctypes
How to Solve ModuleNotFoundError: No Module Named '_Ctypes' in Python | Delft Stack
February 12, 2024 - Incorrect path configurations can lead to the '_ctypes' module not being found. ... If the issue persists, consider using a different Python distribution (e.g., Anaconda) or creating a new virtual environment to isolate the problem.
🌐
Python.org
discuss.python.org › python help
Modul _ctypes not found - Python Help - Discussions on Python.org
August 9, 2024 - File “/usr/local/lib/python3.12/ctypes/init.py”, line 8, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named ‘_ctypes’
🌐
PyTutorial
pytutorial.com › understanding-and-resolving-modulenotfounderror-no-module-named-_ctypes
PyTutorial | Fix ModuleNotFoundError: No module named '_ctypes'
October 13, 2024 - For Linux users, installing libffi-dev and rebuilding is the key. On macOS, updating Xcode tools and linking Homebrew's libffi works best. Windows users should try a clean reinstall of Python or a fresh conda environment.
🌐
Manjaro Linux
forum.manjaro.org › support › third-party software
No module named _ctypes error Python 3.7.12 - Third-Party Software - Manjaro Linux Forum
January 24, 2022 - I am trying to setup my Manjaro GNOME for Python development. The project is a Flask project. The project requires Python 3.7.12. I have installed the correct version using pyenv. When building the project (all the commands are specified in a makefile), the correct venv is created using the ...
🌐
Stack Overflow
stackoverflow.com › questions › 78815899 › no-module-named-ctypes-despite-trying-various-methods
python - No module named '_ctypes' despite trying various methods - Stack Overflow
I am using venv within wsl in vscode for windows machine. Despite installing requirements.txt everytime I run python -m main.py I get this error : from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes'.
🌐
Google Groups
groups.google.com › g › pyglet-users › c › bbAU0jRAO5Q
ImportError: No module named ctype
hello, I just installed pyglet and got the following: >>> from pyglet import font Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> from pyglet import font File "C:\Python25\Lib\site-packages\pyglet\__init__.py", line 67, in <module> _require_ctypes_version('1.0.0') File "C:\Python25\Lib\site-packages\pyglet\__init__.py", line 62, in _require_ctypes_version import ctypes ImportError: No module named ctypes i'm running python 2.5 and assumed ctypes was included.