Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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
like image 249
aussastan Avatar asked Oct 15 '25 19:10

aussastan


1 Answers

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.

like image 107
wim Avatar answered Oct 18 '25 09:10

wim



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!