Scores of new small solar farms that sell clean, local electricity directly to customers are popping up. The setup, dubbed “community solar,” is designed to bring solar power to people who don’t own their own homes or can’t install panels — often at prices below retail electricity rates.
I think it is also ok to accept that cities won't produce all that they consume. They need to import food, water, makes sense that they import energy too.
Tucson, Arizona in the Sonoran Desert receives more rainfall annually than the amount of water sourced municipally. In other words, even in a desert city like Tucson, there's no need to import water. We are wasteful not by nature but by habit, and that can be changed. Rainwater harvesting with thoughtful usage, mulching and locally-appropriate plants and greywater provide all the water necessary except in the most extreme environments such as Death Valley. But even in Death Valley a single family home could provide all its own water through the above if they were also doing solar distillation and reuse.
With proper management and cultural development, cities can provide all their own water and energy and a substantial portion of food.
I agree but just want to add that at least some people in apartments and condos can still produce and use solar-generated electricity. Here's a cool example:
Although I have rooftop solar producing around 200% of our usage annually, I was inspired by this story and have been increasingly using our offgrid LFP (LiFePO4 / lithium iron phosphate) backup batteries with solar panels to power certain things.
I think people in apartments would need rooftop access (ideally), equator-facing windows or a balcony, at the very least, for this to make ecological sense as there's a carbon cost to manufacturing batteries and solar panels. But it's doable and some people are doing it!