keras-tuner icon indicating copy to clipboard operation
keras-tuner copied to clipboard

Error when trying to import keras_tuner

Open DManowitz opened this issue 1 year ago • 5 comments

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!

DManowitz avatar Jun 13 '23 02:06 DManowitz

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

fredopogi avatar Nov 25 '23 03:11 fredopogi

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

rjavierch avatar Jan 23 '24 05:01 rjavierch

Same issue there. Has anyone solved it ?

Grrammel avatar Apr 24 '24 12:04 Grrammel