Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install DistUtilsExtra on Python compiled from sources?

I'm working on a Raspberry Pi. For some complex reasons I'd rather not get into, I had to remove Python2 and Python3 from the system, and compile Python 3.9.2 from scratch. Works great.

Unfortunately, now, I need Ansible to configure the system, which requires python3-apt if you plan to use a task that uses the apt module, which I do. python3-apt appears to just be python-apt, which I can install with pip.

Unfortunately, when I try that (pip install python-apt), I get this:

ModuleNotFoundError: No module named 'DistUtilsExtra'

If my python was installed with apt, I could just do:

sudo apt-get install python3-distutils-extra

But that depends on the python packages from the apt repos, so it will install Python from apt, which I don't want.

python3-distutils-extra appears to just be a python package, but I can't seem to find it on pypi. Is there a way to install it without using apt?

Or should I just tell apt to install the package, and ignore installing dependencies?

like image 906
John Avatar asked Nov 24 '25 11:11

John


1 Answers

A possible workaround is to rebuild the wheel from the source code of the apt package

apt-get source python3-distutils-extra
cd python-distutils-extra-2.40
python3.9 -m pip install wheel  # You'll need this to run setup.py
python3.9 setup.py bdist_wheel  # Create the wheel
python3.9 -m pip install dist/python_distutils_extra-2.39-py3-none-any.whl  # Install the wheel
like image 91
user2604969 Avatar answered Nov 26 '25 00:11

user2604969



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!