Search code examples
pythonread-the-docs

Read the Docs: Distutils2 error during installation


I try to install local instance of Read the Docs on my Win10

When I follow this documentation:
http://docs.readthedocs.io/en/latest/install.html

and type:

pip install -r requirements.txt

I get this error:

Collecting Distutils2==1.0a3 (from -r requirements/pip.txt (line 65))
  Using cached Distutils2-1.0a3.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\USER\AppData\Local\Temp\pip-build-xseiavup\Distutils2\setup.py", line 9, in <module>
        from distutils2.util import find_packages
      File "C:\Users\USER\AppData\Local\Temp\pip-build-xseiavup\Distutils2\distutils2\util.py", line 174
        except KeyError, var:
                       ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\USER\AppData\Local\Temp\pip-build-xseiavup\Distutils2\

Anyone know this error?

My pip version: 8.1.2;
python: 3.5


Solution

  • Is it possible you are running the Python 2 pip? The error message clearly indicates that the code is being executed under Python 3 but has Python 2 syntax. Do you get better results with

    python -m pip install -r requirements.txt
    

    I wonder? If not then verify that

    python
    

    runs version 3.5 ...

    Oh. I just checked and the disutils2 page on PyPI says

    Distutils2 development is stopped.

    tl;dr: keep using setuptools and pip for now, don’t use distutils2.

    It looks like there was never a Python 3 version. Looks like you might need to update your code.