The error seems to be a bug with current release of keras package. Please remove it and try keras3 instead as suggested here
keras
keras3