I am using Anaconda and already have TensorFlow and Keras imported, and I tried to import keras using the following code
import keras as ks
but it didn't work instead I got the follwing error:
AttributeError Traceback (most recent call last)
Cell In[5], line 1
----> 1 import keras as ks
File ~\anaconda3\Lib\site-packages\keras\__init__.py:27
24 # See b/110718070#comment18 for more details about this import.
25 from keras import models
---> 27 from keras.engine.input_layer import Input
28 from keras.engine.sequential import Sequential
29 from keras.engine.training import Model
File ~\anaconda3\Lib\site-packages\keras\engine\input_layer.py:21
19 from keras import backend
20 from keras.distribute import distributed_training_utils
---> 21 from keras.engine import base_layer
22 from keras.engine import keras_tensor
23 from keras.engine import node as node_module
File ~\anaconda3\Lib\site-packages\keras\engine\base_layer.py:33
31 from keras import backend
32 from keras import constraints
---> 33 from keras import initializers
34 from keras import regularizers
35 from keras.engine import base_layer_utils
File ~\anaconda3\Lib\site-packages\keras\initializers\__init__.py:24
22 from keras.initializers import initializers_v1
23 from keras.initializers import initializers_v2
---> 24 from keras.utils import generic_utils
25 from keras.utils import tf_inspect as inspect
26 from tensorflow.python.ops import init_ops
File ~\anaconda3\Lib\site-packages\keras\utils\generic_utils.py:35
32 import numpy as np
34 from keras.utils import tf_contextlib
---> 35 from keras.utils import tf_inspect
36 from tensorflow.python.util.tf_export import keras_export
38 _GLOBAL_CUSTOM_OBJECTS = {}
File ~\anaconda3\Lib\site-packages\keras\utils\tf_inspect.py:23
20 import functools
21 import inspect as _inspect
---> 23 ArgSpec = _inspect.ArgSpec
26 if hasattr(_inspect, 'FullArgSpec'):
27 FullArgSpec = _inspect.FullArgSpec # pylint: disable=invalid-name
AttributeError: module 'inspect' has no attribute 'ArgSpec'
I have tried multiple times of uninstalling and reinstalling Python, Anaconda, Tensorflow, and Keras, and it always have showed this error.
This keras bug says that Keras isn't ready for python 3.11 yet. I suggest downgrading to python 3.10.