This is because you are trying to import the LSTM layer from the tensorflow.python module which doesn't work for keras version 3.
tensorflow.python
Here’s how you can import it correctly:
from tensorflow.keras.layers import LSTM, Dense