pyjnius icon indicating copy to clipboard operation
pyjnius copied to clipboard

“python_requires” should be set with “>=3.6”, as pyjnius 1.4.1 is not compatible with all Python versions.

Open PyVCEchecker opened this issue 2 years ago • 1 comments

Currently, the keyword argument python_requires of setup() is not set, and thus it is assumed that this distribution is compatible with all Python versions. However, I found it is not compatible with Python<3.6. My local Python version is 3.5, and I encounter the following error when executing “pip install pyjnius”

Collecting pyjnius
  Downloading pyjnius-1.4.1.tar.gz (47 kB)
     |████████████████████████████████| 47 kB 232 kB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python /usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp61sq3ndw
       cwd: /tmp/pip-install-4yqajmr2/pyjnius
  Complete output (21 lines):
  Traceback (most recent call last):
    File "/usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-wavx3f29/overlay/lib/python3.5/site-packages/setuptools/build_meta.py", line 150, in get_requires_for_build_wheel
      config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-wavx3f29/overlay/lib/python3.5/site-packages/setuptools/build_meta.py", line 130, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-wavx3f29/overlay/lib/python3.5/site-packages/setuptools/build_meta.py", line 254, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/tmp/pip-build-env-wavx3f29/overlay/lib/python3.5/site-packages/setuptools/build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 24, in <module>
      from env import (
    File "jnius/env.py", line 353
      print(f"         Using cpu = '{machine}' instead!")
                                                       ^
  SyntaxError: invalid syntax
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp61sq3ndw Check the logs for full command output.

I found that jnius/env.py used the syntax feature f-string. The feature is only compatible with Python 3.6 and above, leading to installation failure of pyjnius in Python3.5.

Way to fix: modify setup() in setup.py, add python_requires keyword argument:

setup(…
     python_requires='>=3.6',
     …)

Thanks for your attention. Best regrads, PyVCEchecker

PyVCEchecker avatar Mar 01 '22 02:03 PyVCEchecker

Oops. Not fixed. Should be an easy PR for someone.

Julian-O avatar Oct 27 '23 03:10 Julian-O