Error: Input 0 is incompatible with layer lstm_1: expected ndim=3, found ndim=2
It's probably this way..(not sure , give it a try)

Iputs needs to be reshaped to be [samples, time steps, features]

so 

TrainX= np.reshape(TrainX,(TrainX.shape[0], 1, TrainX.shape[1]))


You need to passin the actual vector also?