keras icon indicating copy to clipboard operation
keras copied to clipboard

Cannot import keras-hub after installation of keras-nlp

Open Mark531 opened this issue 1 year ago • 2 comments

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 avatar Nov 04 '24 13:11 Mark531

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.

Mark531 avatar Nov 04 '24 14:11 Mark531

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 avatar Nov 05 '24 14:11 mehtamansi29

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.

github-actions[bot] avatar Nov 20 '24 02:11 github-actions[bot]

This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.

github-actions[bot] avatar Dec 04 '24 02:12 github-actions[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Dec 04 '24 02:12 google-ml-butler[bot]