You can also have an airport in the middle of a city and an apartment complex in the middle of the desert - there's nothing that stops them technologically. The problem is that they don't make economical sense.
I wonder does it actually do make economic sense? Like will the net from selling produce be larger than just renting the same floorspace for some other use? Be it residential, office, shops or manufacturing...
There are many empty spaces created because of factories moved to China or because people are ordering from amazon(and supermarkets have closed down) and even in covid times people need to eat, while rest of the business in city has been shut down.
It does not make much sense to grow wheat, but it makes sense to grow spices or other products that are transported from afar and which can be grown local indoors instead.
Also, those vertical(and indoor) farms use LEDs, that consume much less energy - not to mention, that plants do not need that much light, than what is needed for humans to feel comfortable.