keras-team / keras-tuner

A Hyperparameter Tuning Library for Keras
https://keras.io/keras_tuner/
Apache License 2.0
2.86k stars 397 forks source link

Error when trying to import keras_tuner #912

Open DManowitz opened 1 year ago

DManowitz commented 1 year ago

Describe the bug When trying to import keras_tuner, I get the following error(s):

Traceback (most recent call last):
  File "...\lib\site-packages\keras_tuner\protos\__init__.py", line 22, in <module>
    from keras_tuner.protos import v4 as protos
  File "...\lib\site-packages\keras_tuner\protos\v4\__init__.py", line 16, in <module>
    from keras_tuner.protos.v4 import keras_tuner_pb2
  File "...\lib\site-packages\keras_tuner\protos\v4\keras_tuner_pb2.py", line 19, in <module>
    from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (...\lib\site-packages\google\protobuf\internal\__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "...\lib\site-packages\keras_tuner\__init__.py", line 17, in <module>
    from keras_tuner import oracles
  File "...\lib\site-packages\keras_tuner\oracles\__init__.py", line 15, in <module>
    from keras_tuner.tuners.bayesian import BayesianOptimizationOracle
  File "...\lib\site-packages\keras_tuner\tuners\__init__.py", line 16, in <module>
    from keras_tuner.tuners.bayesian import BayesianOptimization
  File "...\lib\site-packages\keras_tuner\tuners\bayesian.py", line 31, in <module>
    from keras_tuner.engine import hyperparameters as hp_module
  File "...\lib\site-packages\keras_tuner\engine\hyperparameters\__init__.py", line 18, in <module>
    from keras_tuner.engine.hyperparameters import hp_types
  File "...\lib\site-packages\keras_tuner\engine\hyperparameters\hp_types\__init__.py", line 18, in <module>
    from keras_tuner.engine.hyperparameters.hp_types.boolean_hp import Boolean
  File "...\lib\site-packages\keras_tuner\engine\hyperparameters\hp_types\boolean_hp.py", line 15, in <module>
    from keras_tuner import protos
  File "...\lib\site-packages\keras_tuner\protos\__init__.py", line 24, in <module>
    from keras_tuner.protos import v3 as protos
  File "...\lib\site-packages\keras_tuner\protos\v3\__init__.py", line 16, in <module>
    from keras_tuner.protos.v3 import keras_tuner_pb2
  File "...\lib\site-packages\keras_tuner\protos\v3\keras_tuner_pb2.py", line 35, in <module>
    _SAMPLING = DESCRIPTOR.enum_types_by_name["Sampling"]
AttributeError: 'NoneType' object has no attribute 'enum_types_by_name'

To Reproduce import keras_tuner

Expected behavior No crash

Additional context

Would you like to help us fix it? YES!

fredopogi commented 1 year ago

Hi! I am experiencing the same problem. Python version is 3.9.17, Keras and TensorFlow version is 2.7.0. I was wondering if you were able to solve this

rjavierch commented 10 months ago

I am currently facing the same issue. Did you manage to solve it?

Grrammel commented 7 months ago

Same issue there. Has anyone solved it ?

Mores-Jr commented 6 months ago

Same issue.

Grrammel commented 6 months ago

I resolved my problem. I think it was a compatibility issue between different packages.