Cities also consume a lot of energy which primarily produced from oil, coal and nuclear power that is extracted and transformed outside of cities.
Even if a city would only consume wind and solar, it's quite likely that the majority of solar panels and wind turbines would be installed outside of the cities themselves.
And even if a city did produce its own power, where are the materials for all those panels and turbines coming from? Where is the sand coming from to melt into glass?