federated icon indicating copy to clipboard operation
federated copied to clipboard

Docs should indicate python 3.10 is required; Fix #3109

Open jlewi opened this issue 2 years ago • 1 comments

  • tensorflow/federated#3109 indicates that Python 3.10 is required to avoid various import errors.

  • Update the documentation to indicate this.

  • https://github.com/tensorflow/federated/issues/3109

jlewi avatar Aug 01 '22 22:08 jlewi

I was able to import tff and use it problem-free with Python 3.9,

$ python3 --version
Python 3.9.12

$ python3 -c "import tensorflow_federated as tff ; print(tff.federated_computation(lambda: 'Hello, World!')())"
b'Hello, World!'

hardik-vala avatar Aug 11 '22 22:08 hardik-vala

@hardik-vala Interesting. Come to think of it; the docker images https://github.com/tensorflow/federated/blob/main/tensorflow_federated/tools/runtime/container/Dockerfile

are also using Python 3.9.12. And seems to work.

So maybe the minimum is 3.9.Y for some Y?

Offhand I unfortunately don't know which version of 3.9 I was using in https://github.com/tensorflow/federated/issues/3109#issuecomment-1200328141

Is it worth updating the docs to point out that it has been tested with 3.9.12 ?

jlewi avatar Aug 16 '22 21:08 jlewi

Looks like the code for the exception is python 3.9.0 https://github.com/python/cpython/blob/9cf6752276e6fcfd0c23fdb064ad27f448aaaf75/Lib/typing.py#L826

Looks like it is fixed in 3.9.2 https://github.com/python/cpython/blob/v3.9.2/Lib/typing.py

jlewi avatar Aug 16 '22 21:08 jlewi

@hardik-vala Updated the docs to indicate 3.9.2 is the minimum.

jlewi avatar Aug 16 '22 21:08 jlewi

@jlewi

We are not currently compatible with Python 3.10 due to some dependency issues that I expect to have resolved soon.

Additionally, we use to document the Python and TF compatibility in the README, but this became something that we needed to maintain in multiple places. Today the Python compatibility is:

  • defined in the setup.py
  • documented on https://pypi.org/project/tensorflow-federated/
  • I thought it was enforced by PIP, but I was mistaken and the classifiers are not taken into account. I am in the process of submitting a change to add https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#python-requires to our configuration. This should make it more obvious when looking at the setup.py what the required Python version is and it should make it more obvious when you invoke pip install that the version of Python you have is not compatible with the version of TFF you are trying to install.

As a result I would like to avoid adding additional documentation that needs to be updated as the Python compatibility changes. However, I appreciate you brining up this issue because I thought that pip was enforcing this and it's clearly not.

michaelreneer avatar Aug 16 '22 23:08 michaelreneer

@michaelreneer Thanks for the detailed explanation.

jlewi avatar Aug 17 '22 15:08 jlewi