Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'numpy' has no attribute '_no_nep50_warning' when importing TensorFlow Federated #4367

Open
arunrajvakathanam opened this issue Dec 13, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@arunrajvakathanam
Copy link

Description:

While trying to use TensorFlow Federated (TFF), I encountered an AttributeError upon importing the tensorflow_federated module. The error message specifically states:

AttributeError: module 'numpy' has no attribute '_no_nep50_warning'
Environment:

Python version: Python 3.10.12

Steps to reproduce:

Run the following Python code:
Python
import tensorflow_federated as tff
Use code with caution. Learn more
Observe the AttributeError message.
Expected behavior:

Importing tensorflow_federated should not cause any errors.

Actual behavior:

The AttributeError message indicates an unexpected internal issue within NumPy, potentially preventing proper initialization of TensorFlow Federated.

source code https://github.com/tensorflow/federated/blob/v0.66.0/docs/tutorials/federated_learning_for_image_classification.ipynb

@arunrajvakathanam arunrajvakathanam added the bug Something isn't working label Dec 13, 2023
@GiuliaFContardi
Copy link

GiuliaFContardi commented Jan 3, 2024

Same problem for the same source code.

Using the link for Google Colab I got:
CODE1:
!pip install --quiet --upgrade tensorflow-federated
OUPUT_ERROR:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. lida 0.0.10 requires fastapi, which is not installed. lida 0.0.10 requires kaleido, which is not installed. lida 0.0.10 requires python-multipart, which is not installed. lida 0.0.10 requires uvicorn, which is not installed. flax 0.7.5 requires jax>=0.4.19, but you have jax 0.4.14 which is incompatible. google-colab 1.0.0 requires portpicker==1.5.2, but you have portpicker 1.6.0 which is incompatible. ipython-sql 0.5.0 requires sqlalchemy>=2.0, but you have sqlalchemy 1.4.20 which is incompatible.

CODE2:
import collections import numpy as np import tensorflow as tf import tensorflow_federated as tff np.random.seed(0) tff.federated_computation(lambda: 'Hello, World!')()

OUTPUT_ERROR: (getting from import tensorflow_federated)
AttributeError: module 'numpy' has no attribute '_no_nep50_warning'

I tried to solve it installing the required packages hoping better results, but I kept getting version conflicts from many packages.

@AlirezaSalehy
Copy link

AlirezaSalehy commented Jan 11, 2024

Same issue, how did you fix that, if ever?

@boxer-code
Copy link

Any updates? I'm facing the same issue.

@arunrajvakathanam
Copy link
Author

arunrajvakathanam commented Jan 31, 2024 via email

@atmadeep
Copy link

Commenting in case a solution is available. Facing the same issue with numpy==1.24.4

@michaelreneer
Copy link
Collaborator

Sorry for coming in late. The problem you are likely seeing is that the runtime you are using in colab has an older version of numpy or an older version of TFF. Some solutions...

  1. Create your own runtime with only TFF and it's dependencies.
  2. Uninstall the conflicting dependencies and install the correct ones.
  3. You can try installing the new ones over top of the old ones.

@michaelreneer michaelreneer self-assigned this Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants