Home > Enterprise >  Pip returning syntax error when installing package in Python 2.7
Pip returning syntax error when installing package in Python 2.7

Time:03-21

I am trying to install a Python package in Wine, but it keeps giving me internal syntax errors. When I tried to install pyinstaller, it gave me this:

C:\>pip install pyinstaller
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting pyinstaller
  Using cached pyinstaller-4.1.tar.gz (3.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\Python27\python.exe' 'c:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\jackpy\temp\tmpo_ofkx'
       cwd: c:\users\jackpy\temp\pip-install-tjtlkl\pyinstaller
  Complete output (19 lines):
  Traceback (most recent call last):
    File "c:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
      main()
    File "c:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "c:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "c:\users\jackpy\temp\pip-build-env-wvrvge\overlay\Lib\site-packages\setuptools\build_meta.py", line 146, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "c:\users\jackpy\temp\pip-build-env-wvrvge\overlay\Lib\site-packages\setuptools\build_meta.py", line 127, in _get_build_requires
      self.run_setup()
    File "c:\users\jackpy\temp\pip-build-env-wvrvge\overlay\Lib\site-packages\setuptools\build_meta.py", line 243, in run_setup
      self).run_setup(setup_script=setup_script)
    File "c:\users\jackpy\temp\pip-build-env-wvrvge\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 63
      file=sys.stderr)
          ^
  SyntaxError: invalid syntax
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\Python27\python.exe' 'c:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\jackpy\temp\tmpo_ofkx' Check the logs for full command output.

I have tried uninstalling and reinstalling using get-pip.py, and it's always the same error.

I am using Python 2.7.18 and Wine 4.0. Can anyone tell me how to fix this?

CodePudding user response:

As far as I can see from the pyinstaller website they have dropped the support of python2.7 from version 4.0, and you are trying to install a version 4.1.0 (https://pyinstaller.readthedocs.io/en/stable/)

Finally, this version drops support for Python 2.7, which is end-of-life since January 2020.. The minimum required version is now Python 3.6.

Also, I do not see any other available version on PyPI, so the only option you have is to upgrade your python to at least version 3.6.

Best of luck!

CodePudding user response:

  1. Get updated version of python. Your version is way too old
  2. Recently I have been gone through that issue, not like yours but kind of. I deleted every single file related to pyinstaller. And gave it a fresh start
  • Related