google/etils

Package broken under Python 3.9

Closed this issue · 6 comments

The epath sub-package is broken under Python 3.9, apparently due to the recent introduction of syntax only supported in Python 3.10 or later in binary_import.py:

import etils.epath

...

File ~/condahome/miniconda3/envs/py39t/lib/python3.9/site-packages/etils/epy/binary_import.py:55
     49       return True
     50   return False
     53 @contextlib.contextmanager
     54 def binary_adhoc(
---> 55     restrict: None | py_utils.StrOrStrList = None,
     56     verbose: bool = False,
     57     **kwargs: Any,
     58 ) -> Iterator[None]:
     59   yield

TypeError: unsupported operand type(s) for |: 'NoneType' and '_UnionGenericAlias'

Thank you for reporting. Could you provide more context how you encountered this bug ?

The last released version of etils explicitly require Python 3.10 and released on PyPI:

requires-python = ">=3.10"

image

PyPI should have raised an error when trying to install the package, so I'm not sure how you were able to install the packaged on 3.9 in the first place.

It was installed from conda-forge, without any warnings or errors.

Closing this. our package has the right metadata. If other packages system install a package not supported by the current python version, this should be reported in conda-forge. There's nothing we can do from the etils side.

FYI this is now effectively meaning I need to bump python to use tensorflow 2.15, as tensorflow-datasets depends on etils. Currently seeing if I can pin etils to an earlier version.

I would suggest you to raise this issue in conda. Our metadata clearly indicates the package is only available for Python 3.10+ (now 3.11).
If conda does not respect this and still install new version of etils on an older Python version, it's definitely not our fault and nothing we can do about.

Irrespective of the issues with the conda metadata, I'm just saying that if you strictly need python 3.10 and above, this now means anyone wanting to use tensorflow 2.15 under certain circumstances will also not be able to use python3.9 without manually downgrading etils.