This tutorial will show you how to Fix the Error Module Not Found named ‘distutils’ (modulenotfounderror: no module named ‘distutils‘) on Debian and Ubuntu. This error happens when you don’t Python distutils module installed on Ubuntu and Debian machines. Follow the steps below to see how you can fix this issue.
Fix Error Module Not Found named ‘distutils’ on Ubuntu and Debian
There are several errors related to the distutils module in Python. The common ones are shown below:
- “ModuleNotFoundError: No module named ‘distutils.util'”
- “ModuleNotFoundError: No module named ‘distutils.cmd'”
- “ModuleNotFoundError: No module named ‘distutils.core'”
- “modulenotfounderror: no module named ‘distutils.sysconfig'”
You can use the following solution for all of the above errors.
Resolve ModuleNotFoundError: No module named ‘distutils’
The distutils module is a part of the Python standard library. So it has to be installed on your Ubuntu and Debian machine to be able to use Python.
To fix the module error, you must install the distutils package with your Python version. Open your terminal, then, use the following syntax to install this package:
sudo apt install python<your-python-version>-distutils
sudo apt install python3.8-distutils
Important Note: In Python 3.10 and 3.11, distutils will be formally marked as deprecated. You can still use this module with warnings in these versions, but the issues will not fix. The code that imports distutils will no longer work from Python 3.12.
For more information, you can visit the Deprecate distutils module.
At this point, you have learned what caused this issue and you can easily install the module with your Python version to fix the Error Module Not Found named ‘distutils’. But you just note that this module is deprecated in Python 3.10 and 3.11. Hope you enjoy it.
Also, you may be interested in these articles: