The military might be capable of a ground invasion and succeeding. It would be Pyrrhic. Even if Iran was a genuine nuclear threat (I am not convinced at this point that Iran would launch a nuke at anyone if they had it), is it worth 500k dead Americans?
There was never a path to victory that didn't involve ground troops. We aren't losing in Iran because of military incompetence, but policy incompetence. Previous administrations did not do this because the cost was well understood.
There has never existed a military who could win this conflict without ground invasion. This was understood when this administration started it.