LMSouq
server-admin Open

How can I install distutils for Python on Ubuntu?

NE
Neo
1 month ago
3 views
Problem Description
I just got some space on a VPS server(running on Ubuntu 8.04), and I'm trying to install Django on it. The server has python 2.5 installed. When I run the Django installation script, I get: amitoj@ninja:~/Django-1.2.1$ python setup.py install Traceback (most recent call last): File "setup.py", line 1, in <module> from distutils.core import setup ImportError: No module named distutils.core I found plenty of information about how to install packages using distutils; but how do I get distutils itself? ---- <sub>**Note that** Setuptools includes a modified version of distutils that includes sub-modules which were never part of the original distutils. See [stdlib's distutils](https://github.com/python/cpython/tree/v3.11.9/Lib/distutils) vs [setuptools' distutils](https://github.com/pypa/setuptools/tree/main/setuptools/_distutils). When these sub-modules are needed, Setuptools must be installed anyway.</sub> <sub>Also note that Setuptools is needed to get this functionality **for Python 3.12 onward**, because Distutils **has been removed from the standard library**. See https://stackoverflow.com/questions/77233855/. It may also be necessary within virtual environments, as in https://stackoverflow.com/questions/54486526.</sub> <sub>However, if you have an ordinary Python distribution, 3.11 or older, which came with the system, on Ubuntu, and a `setup.py` or other code which is looking for the standard `distutils` functionality - the problem is that the Ubuntu maintainers have not included it with the bundled Python. It needs to be installed using the system package manager, as described in answers here.</sub>

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base