And nice cop you have there. Its because the US public didn't want it. Not because US military capabilities were up to the mark. Nice try.
Was the 300 billion war reparations US signed to pay also something that the US public wanted?
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.