aussastan
aussastan

Reputation: 57

"SyntaxError: invalid syntax" while installing Setuptools

I needed to install Setuptools for a project I was doing, and I had to download Setuptools through a .tar file (don't ask), but when ran the command I needed to use to install it:

C:\Users\myname\Downloads\setuptools-51.1.1>py -2 setup.py install

It ended up with a SyntaxError:

    Traceback (most recent call last):
      File "setup.py", line 7, in <module>
        import setuptools
      File "C:\Users\myname\Downloads\setuptools-51.1.1\setuptools\__init__.py", line 16, in <module>
        import setuptools.version
      File "C:\Users\myname\Downloads\setuptools-51.1.1\setuptools\version.py", line 1, in <module>
        import pkg_resources
      File "C:\Users\myname\Downloads\setuptools-51.1.1\pkg_resources\__init__.py", line 1365
        raise SyntaxError(e) from e
                                ^
    SyntaxError: invalid syntax

I'm using Python 2.7.

Why is it showing the error, and how can I fix it?

Edit:

When I looked into the __init__.py file, I found that there was something called an "invalid marker":

    try:
        marker = packaging.markers.Marker(text)
        return marker.evaluate()
    except packaging.markers.InvalidMarker as e:
        raise SyntaxError(e) from e

Upvotes: 4

Views: 9673

Answers (1)

wim
wim

Reputation: 363243

The last version of setuptools to support Python 2.7 was 44.1.1 (Jan 2020). See the changelog.

Upgrade your Python version in order to use setuptools 51.1.1.

Upvotes: 4

Related Questions