keras
keras copied to clipboard
Cannot import keras-hub after installation of keras-nlp
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)
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.
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.
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.