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

Cannot import keras-hub after installation of keras-nlp #20446

Open
Mark531 opened this issue Nov 4, 2024 · 2 comments
Open

Cannot import keras-hub after installation of keras-nlp #20446

Mark531 opened this issue Nov 4, 2024 · 2 comments
Assignees
Labels
stat:awaiting response from contributor type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.

Comments

@Mark531
Copy link

Mark531 commented Nov 4, 2024

I installed keras-nlp:
>pip install --upgrade keras-nlp

Successfully installed google-auth-oauthlib-0.4.6 keras-2.10.0 protobuf-3.19.6 tensorboard-2.10.1 tensorboard-data-server-0.6.1 tensorflow-2.10.1 tensorflow-estimator-2.10.0

(BTW, it downgraded my version of tensorflow which was not expected)

Then, in a python script:
import keras_hub
triggers:

ImportError: cannot import name 'ops' from 'keras' (C:\Users\kevguima\AppData\Local\anaconda3\envs\genai\lib\site-packages\keras_init_.py)

@Mark531
Copy link
Author

Mark531 commented Nov 4, 2024

I reinstalled keras-nlp from a fresh virtual env and this time, I got a different error:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.3 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

This suggests that a dependency is missing about numpy v1.x because keras-nlp could install properly, and the error popped during the import.

@mehtamansi29
Copy link
Collaborator

Hi @Mark531 -

Thanks for reporting the issue. I am not able to get any ImportError while using import keras_hub.
Attached gist for the reference as well.

And if you are still able to reproduce the issue you can try to install keras-hub using pip install --upgrade keras-hub and then import keras_hub.

@mehtamansi29 mehtamansi29 added type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited. stat:awaiting response from contributor labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response from contributor type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.
Projects
None yet
Development

No branches or pull requests

2 participants