A local green energy start-up called Energy and Environmental Sustainability — Suema, by its Spanish acronym — got the idea to develop a biogas generator to turn that waste into energy.
They decided to build it right at the source: the bustling cactus market, where hundreds of workers start each day by cleaning up the waste left from the day before.
Oil-producing Mexico has emerged as a green energy leader in recent years.
It won praise in 2015 when it became the first emerging country to announce its emissions reduction targets for the United Nations climate accord, ambitiously vowing to halve them by 2050.
To get there, it is seeking to generate half its energy from renewable sources.
Last year, green energy made up 15.4 percent of its energy mix — though just 0.1 percent was from biogas.
Suema is looking to change that with its generator, which will ultimately produce 175 kilowatt hours — enough electricity to keep some 9,600 low-energy light bulbs burning.
The generator — a giant silver cylinder surrounded by an intricate web of pipes — churns together organic waste with a special mix of bacteria and heats it to 55 degrees Celsius (131 Fahrenheit) to produce biogas.
The leftovers can then be used as compost.
RELATED: Next-Gen Geothermal Could Unlock Vast Energy Supplies Just Below Earth’s Surface
When it reaches full capacity around November, the generator will be able to process three to five tons of waste a day, producing 170 cubic meters (45,000 gallons) of biogas plus a little more than one ton of compost.
The $840,000 project, funded mostly by the Mexico City government, is popular at the cactus market.
"It's a good idea, because now all this waste will do something productive," said vendor Evangelina Lara, 45, wearing a red apron and wielding the knife she uses to clean her stock.
The Mexico City government's scientific development chief, Bernardino Rosas, hopes the generator will be the first of many.
"Our vision is to reproduce this type of project" at each of the city's more than 300 produce markets, making them energy self-sufficient, he told AFP.
In Aztec mythology, Huitzilopochtli — the god of the sun, war and human sacrifice — tore out the heart of a treacherous prince named Copilli and threw it into a lake.
The first prickly pear cactus supposedly grew on an island in that lake — its juicy red fruit symbolizing Copilli's heart.
According to the legend, Huitzilopochtli told the Aztecs to build a city at the spot where they found the cactus, which would have an eagle sitting atop it eating a snake.
RELATED: To Convince Climate Deniers, Try Fewer Charts and More Empathy
The story has it that this is where the Aztecs built their capital, Tenochtitlan — over whose ruins the Spanish conquistadors built Mexico City.
Today, the prickly pear cactus with the eagle eating the snake is a national symbol — so much so that it appears at the center of Mexico's green, white and red flag.
This all makes the cactus a very fitting fuel for Mexico's future, said Horacio Chavira, deputy director for rural development in Milpa Alta.
"The prickly pear cactus is so Mexican that it's a symbol of our identity," he said.
WATCH: Which Countries Run on 100 percent Renewable Energy?