I faced a similar problem. The problem in my case was, Number of rows in X was not equal to number of rows in y.
i.e. number of entries in feature columns was not equal to number of entires in target variable since I had dropped some rows from freature columns.