Install distutils for your-python-version:
!sudo apt-get install python<your-python-version>-distutils For example, to install in Python version 3.8 version:
sudo apt-get install python3.8-distutils Specification: In Python 3.10 and 3.11, distutils will be formally marked as deprecated. All known issues will be closed at this time.
Note: You could still use distutisldistutils with warning in 3.10 and 3.11 and any issues that arises will not be fixed. But, Code that imports distutils will no longer work from Python 3.12.
For more info: MigragtionMigration Advice