Tensorflow.Keras not recognised on PyCharm M1 Mac

Viewed 38

I am learning machine learning and trying to create a one output from 3 input single layer from Kaggle, I am trying to import tensor flow and keras with the following code:

from tensorflow import keras
from tensorflow.keras import layers

# Create a networkth 1 linear unit
model = keras.Sequential([
    layers.Dense(unit =1, input_shape=[3])
])

but I get the following error:

"/Users/ahmedhamadto/PycharmProjects/Deep Learning/venv/bin/python" "/Users/ahmedhamadto/PycharmProjects/Deep Learning/main.py"
Traceback (most recent call last):
  File "/Users/ahmedhamadto/PycharmProjects/Deep Learning/main.py", line 1, in <module>
    from tensorflow import keras
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tensorflow/__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tensorflow/python/__init__.py", line 37, in <module>
    from tensorflow.python.eager import context
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tensorflow/python/eager/context.py", line 29, in <module>
    from tensorflow.core.framework import function_pb2
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tensorflow/core/framework/function_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/google/protobuf/pyext/_message.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (__ZNK6google8protobuf10TextFormat21FastFieldValuePrinter19PrintMessageContentERKNS0_7MessageEiibPNS1_17BaseTextGeneratorE)

Process finished with exit code 1

I am using a M1 Pro MacBook Pro incase the info is relevant.

0 Answers
Related