google-parfait / tensorflow-federated

An open-source framework for machine learning and other computations on decentralized data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installtion failed

lwmonster opened this issue · comments

Describe the bug
TFF installtion failed.
First, I install TFF by default, it installed successfully, but it can't work as expected, error :

liangwei @ ubuntu in ~ [10:10:36]
$ pip list | grep tensorflow
tensorflow 2.16.1
tensorflow-federated 0.1.0
tensorflow-io-gcs-filesystem 0.36.0

(tff)
liangwei @ ubuntu in ~ [10:10:42]
$ python -c "import tensorflow_federated as tff; print(tff.federated_computation(lambda: 'Hello World')())"
2024-04-15 10:10:48.064401: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2024-04-15 10:10:48.068130: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2024-04-15 10:10:48.128496: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-04-15 10:10:48.983957: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
File "", line 1, in
File "/home/liangwei/miniconda3/envs/tff/lib/python3.9/site-packages/tensorflow_federated/init.py", line 25, in
from tensorflow_federated.python import *
File "/home/liangwei/miniconda3/envs/tff/lib/python3.9/site-packages/tensorflow_federated/python/init.py", line 25, in
from tensorflow_federated.python.core import *
File "/home/liangwei/miniconda3/envs/tff/lib/python3.9/site-packages/tensorflow_federated/python/core/init.py", line 21, in
from tensorflow_federated.python.core import utils
File "/home/liangwei/miniconda3/envs/tff/lib/python3.9/site-packages/tensorflow_federated/python/core/utils/init.py", line 26, in
from tensorflow_federated.python.core.utils.computation_utils import IterativeProcess
File "/home/liangwei/miniconda3/envs/tff/lib/python3.9/site-packages/tensorflow_federated/python/core/utils/computation_utils.py", line 21, in
from tensorflow_federated.python.core import api as tff
File "/home/liangwei/miniconda3/envs/tff/lib/python3.9/site-packages/tensorflow_federated/python/core/api/init.py", line 22, in
from tensorflow_federated.python.core.api.computation_types import FederatedType
File "/home/liangwei/miniconda3/envs/tff/lib/python3.9/site-packages/tensorflow_federated/python/core/api/computation_types.py", line 26, in
from tensorflow_federated.python.common_libs import anonymous_tuple
File "/home/liangwei/miniconda3/envs/tff/lib/python3.9/site-packages/tensorflow_federated/python/common_libs/anonymous_tuple.py", line 28, in
nest = tf.contrib.framework.nest
AttributeError: module 'tensorflow' has no attribute 'contrib'

It seems the TFF version is too old, so I try to install a newer version, but it reported an error of jaxlib :

liangwei @ ubuntu in ~ [10:10:49] C:1
$ pip install tensorflow-federated==0.48.0
Collecting tensorflow-federated==0.48.0
Using cached tensorflow_federated-0.48.0-py2.py3-none-any.whl (42.8 MB)
Collecting attrs~=21.4
Using cached attrs-21.4.0-py2.py3-none-any.whl (60 kB)
Collecting tensorflow-model-optimization==0.7.3
Using cached tensorflow_model_optimization-0.7.3-py2.py3-none-any.whl (238 kB)
Collecting farmhashpy==0.4.0
Using cached farmhashpy-0.4.0-cp39-cp39-manylinux2010_x86_64.whl (120 kB)
Collecting cachetools~=3.1
Using cached cachetools-3.1.1-py2.py3-none-any.whl (11 kB)
Collecting tqdm~=4.64
Using cached tqdm-4.66.2-py3-none-any.whl (78 kB)
ERROR: Could not find a version that satisfies the requirement jaxlib==0.3.14 (from tensorflow-federated) (from versions: 0.4.6, 0.4.7, 0.4.9, 0.4.10, 0.4.11, 0.4.12, 0.4.13, 0.4.14, 0.4.16, 0.4.17, 0.4.18, 0.4.19, 0.4.20, 0.4.21, 0.4.22, 0.4.23, 0.4.24, 0.4.25, 0.4.26)
ERROR: No matching distribution found for jaxlib==0.3.14

I can't find jaxlib 0.3.14 anywhere.

Environment (please complete the following information):

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
  • Python package versions (e.g., TensorFlow Federated, TensorFlow):
    tensorflow 2.16.1
    TensorFlow Federated 0.48.0
  • Python version: 3.9.19
  • Bazel version (if building from source): None
  • CUDA/cuDNN version: None
  • What TensorFlow Federated execution stack are you using?

Im trying to install and in getting similar issues, i have tried different python versions and different tensorflow-federated versions.

OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 11 Home
Python package versions (e.g., TensorFlow Federated, TensorFlow):
tensorflow:
TensorFlow Federated 0.48.0, 0.20.0
Python version: 3.9, 3.10, 3.12
Bazel version (if building from source): None
CUDA/cuDNN version: None

trying python 3.8.3 installed the package but give me this error:

import tensorflow_federated as tff
print(tff.federated_computation(lambda: 'Hello, World!')())


RuntimeError Traceback (most recent call last)
in
1 import tensorflow_federated as tff
----> 2 print(tff.federated_computation(lambda: 'Hello, World!')())

c:\Python38\lib\site-packages\tensorflow_federated\python\core\impl\utils\function_utils.py in call(self, *args, **kwargs)
519 context = self._context_stack.current
520 arg = pack_args(self._type_signature.parameter, args, kwargs, context)
--> 521 return context.invoke(self, arg)
522
523 def hash(self):

c:\Python38\lib\site-packages\retrying.py in wrapped_f(*args, **kw)
54 @six.wraps(f)
55 def wrapped_f(*args, **kw):
---> 56 return Retrying(*dargs, **dkw).call(f, *args, **kw)
57
58 return wrapped_f

c:\Python38\lib\site-packages\retrying.py in call(self, fn, *args, **kwargs)
255
256 if not self.should_reject(attempt):
--> 257 return attempt.get(self._wrap_exception)
258
...
--> 554 raise RuntimeError(
555 'Cannot run the event loop while another loop is running')
556

RuntimeError: Cannot run the event loop while another loop is running

@lwmonster did you find a way to install it?

@Neisser

When you say install. Do you mean pip install tensorflow-federated or do you mean use TFF? I see from the logs you shared that you are getting a RuntimeError, so I am going to assume you mean after you pip install tensorflow-federated. However, you also said your OS was Win 10, which is surprising to me because I would have thought that you would have gotten an error trying to pip install tensorflow-federated on Windows. Note that TFF does not release a package for this OS, see https://pypi.org/project/tensorflow-federated/.

Can you clarify the OS you are trying to run on.

hi @michaelreneer the OS im trying to run is Windows 11 Home

Currently, TFF does not produce a package that will work on this platform.

I see, then I believe I know what has happened. We did not initially have the package configured correctly to restrict the platform the package would work on. So I imagine you are pulling in an older version of TFF when pip installing on Windows (i.e. the newest version that pip thinks is compatible with Windows). Which you can see that you are using a version of TFF that is quite old. However, this package was not intended to work on Windows.

TensorFlow Federated 0.48.0, 0.20.0

You will need to try and build TFF from source on Windows to use TFF on this platform.