Tensorflow federated installation giving error

154 views Asked by At

I´m trying to install Tensorflow Federated by running pip install tensorflow-federated in a new Anaconda environment with Python 3.11 in Windows but it gives me this error:

  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 "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-k_gm1isk\absl-py_2a985a0a199a4b93b9e364bfe5d6f101\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.

I´ve tried to install it in other versions of python but it only works on Python 3.8 and at that point some versions of libraries are to old to work and comes up with compatability issues.

Would appreciate some help!

And thanks for your time!

2

There are 2 answers

1
FlyingTeller On

tensorflow-federated is not supported on windows, see https://github.com/tensorflow/federated/issues/4207:

Unfortunately no, we do not support Windows at this time.

and https://github.com/tensorflow/federated/issues/779

I think we unfortunately are simply unlikely to attempt to add windows support in the near future. There is some nontrivial setup that would have to happen on our side, and it's not currently considered a high priority.

That said, a solution like virtualbox or docker (maybe even Windows Subsystem for Linux?) should allow you to run TFF on a Windows machine, though there may be some slightly gnarly edges.

What happens in your case is that pip goes back to older and older versions of tensorflow-federated that did not explicitly state that they are not for windows and then fails for tensorflow_federated-0.17 when it is trying to build the dependency absl-py-0.9.0.tar.gz. In its setup.py, this package has the version check implemented as

if py_version < ('2', '7') or py_version[0] == '3' and py_version < ('3', '4')

which did work for python versions <3.10 but fails as the string comparison of '10' and '4' evaluates to '10' < '4'`, hecne the error message that the python version is too low

Your solution here:

As mentioned in the quote from github, use a linux system through virtualization, docker, wsl or dual-boot

1
Sara Houshmand On

I had the same issue, but it was resolved when I installed Python3.8