abseil/abseil-py

Fix Python 3.10 compatibility

musicinmybrain opened this issue · 2 comments

On Python 3.10, setup.py incorrectly raises RuntimeError('Python version 2.7 or 3.4+ is required.').

Instead of

py_version = platform.python_version_tuple()
if py_version < ('2', '7') or py_version[0] == '3' and py_version < ('3', '4'):
  raise RuntimeError('Python version 2.7 or 3.4+ is required.')

please consider a trivial change to

py_version = sys.version_info
if py_version < (2, 7) or py_version[0] == 3 and py_version < (3, 4):
  raise RuntimeError('Python version 2.7 or 3.4+ is required.')

in order to compare versions as numbers rather than strings.

pip install rasa on 3.10 python is still failing wih this error.
What is the possible workaround?

  Using cached absl-py-0.9.0.tar.gz (104 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-jpqgvzg2/absl-py_442e8f35b9964a6c91bedd5edb00519b/setup.py", line 34, in <module>
          raise RuntimeError('Python version 2.7 or 3.4+ is required.')
      RuntimeError: Python version 2.7 or 3.4+ is required.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
yilei commented

Using cached absl-py-0.9.0.tar.gz (104 kB)

The issue was fixed in v0.12.0 and your log shows it's installing an older v0.9.0 version