skip to Main Content

I’m attempting to install python3-distutils on Ubuntu 24.04 using the command sudo apt-get install python3-distutils, but encountering an error. Could someone please provide an alternative method to download and install python3-distutils?

root@vps:~# apt-get install python3-distutils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python3-distutils is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python3-distutils' has no installation candidate

In my attempt to install python3-distutils on Ubuntu 24.04, I used the command sudo apt-get install python3-distutils. I expected this command to successfully install the python3-distutils package without any errors. However, I encountered an error indicating that the package could not be found, which led me to seek alternative methods for downloading and installing python3-distutils

2

Answers


  1. distutils has been deprecated in Python 3.12, the version Ubuntu 24.04 is using, see PEP 632 for details.

    As suggested in the documentation, you can use setuptools as an enhanced alternative.

    The recommended pip installer runs all setup.py scripts with setuptools, even if the script itself only imports distutils.

    That means,

    $ pip install setuptools
    
    Login or Signup to reply.
  2. This does not answer the original question directly, but I hope it will help you get around it. I also struggled with installing python3-distutils on Ubuntu 24.04, and never got it work. I learned that Ubuntu 24.04 discourages and fights attempts to install pip and python3-distutils into the global environment (which is probably a bad practice anyway). Once you create a python virtual environment, you are able to use pip in that virtual environment without any problems, and I did not even have to install python3-distutils explicitly.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search