It's not easy having a green thumb in space.

Without gravity, seeds can float away. Water doesn't pour, but globs up and may drown the roots. And artificial lights and fans must be rigged just right to replicate the sun and wind.

But NASA has decided that gardening in space will be crucial for the next generation of explorers, who need to feed themselves on missions to the Moon or Mars that may last months or years.

Scroll down for video

Tomatoes grow in an LED-lighted box, similar to what astronauts use to grow lettuce on the International Space Station, at Fairchild Tropical Botanic Garden in Miami. The Miami-based garden has identified 106 plant varieties that might do well in space, including hardy cabbages and leafy lettuces.

WHAT'S ON THE SPACE MENU? The Miami-based Fairchild Tropical Botanic Garden has identified 106 plant varieties that might do well in space, including hardy cabbages and leafy lettuces. Some of the student-tested crops are expected to launch in coming months, including dragoon lettuce and extra dwarf pak choi. By next year, tomatoes could be on the menu. Advertisement

Necessary nutrients, like vitamins C and K, break down over time in freeze-dried foods.

Without them, astronauts are increasingly vulnerable to infections, poor blood clotting, cancer and heart disease.

So the US space agency has turned to professional botanists and novice gardeners - high school students, in fact - to help them practice.

'There are tens of thousands of edible plants on Earth that would presumably be useful, and it becomes a big problem to choose which of those plants are the best for producing food for astronauts,' explained Carl Lewis, director of the Fairchild Tropical Botanic Garden, which is leading the effort.

'And that is where we come in.'

The Miami-based garden has identified 106 plant varieties that might do well in space, including hardy cabbages and leafy lettuces.

They have enlisted 15,000 student botanists from 150 schools to grow plants in space-like conditions in their own classrooms.

The four-year project is about midway through, and is paid for by a $1.24 million grant from NASA.

Using trays rigged with lights that mimic the grow boxes used in space, students must tend to the plants and record data on their progress, which eventually gets shared with NASA.

High school students specializing in botany attend an event at Fairchild Tropical Botanic Garden in Miami where they talk about space gardening with astronauts Ricky Arnold and Drew Feustel via video downlink from the International Space Station

JoLynne Woodmansee (L), a teacher at BioTECH High School, sits with her students during at an event at Fairchild Tropical Botanic Garden in Miami on April 25, 2018, where students spoke live with astronauts on the International Space Station

'We're not using typical gardening equipment,' said Rhys Campo, a 17-year-old high school student who tried her hand at growing red romaine lettuce this year.

'We have setups that are a lot more high-tech.'

Still, some plants get overwatered, some classrooms are hotter or colder than others, and holiday breaks may leave the grow boxes unattended.

In Campo's class, the lettuce dried up, and students were unable to taste it.

Such foibles have turned out to be an unexpected but useful part of the project, said NASA plant scientist Gioia Massa.

'If you have a plant that does well in all that variability, chances are that plant will do well in space,' she told AFP.

Astronauts living at the space station, 250 miles (400 kilometers) above Earth have encountered their share of failures while gardening in orbit, too.

The first portable growing box for space, equipped with LED lights, called Veggie, was tested at the orbiting outpost in 2014.

Some of the lettuce didn't germinate, and some died of drought.

A 2014 Nasa mission focused on 'robogardens' used to grow plants in space. Here, the crew are pictured with the red romaine lettuce that was successfully grown on-board the ISS

But astronauts kept trying, and finally took their first bite of NASA-approved space-grown lettuce in 2015.

Now, there are two Veggie grow boxes at the ISS, along with a third, called the Advanced Plant Habitat.

The food being grown is only occasionally harvested, and amounts to just a leaf or two per astronaut, but it's worth it, said NASA astronaut Ricky Arnold, during a live video downlink with students at Fairchild last month.

'The textures of food are all kind of very similar,' he said of the freeze-dried fare available on board the ISS.

'When we are able to harvest our own lettuce here, just having a different texture to enjoy is a really nice diversion from the standard menu.'

Plants don't need gravity in order to grow. They just orient themselves to the light.

According to Massa, a good space plant has to be compact and produce a lot of edible food.

Plants also have to do well in a spaceship like the ISS, which has a temperature of 71 degrees Fahrenheit (22 Celsius), 40 percent relative humidity, and high carbon dioxide -- some 3,000 parts per million.

'That is something plants aren't adjusted to,' said Massa. 'On Earth it is about 400 ppm.'

Under a system Massa described as akin to hydroponics but not exactly the same, space plants also have to germinate from a plant pillow with only a small amount of dirt, do well under LED lights, and be microbially fairly clean, because it is hard to wash vegetables in space.

Some of the student-tested crops are expected to launch in coming months, including dragoon lettuce and extra dwarf pak choi.

By next year, tomatoes could be on the menu.

NASA is looking into the possibility of robotic space gardening, to automate the process so crew can focus on other tasks.

But many astronauts say they like tending to plants, because it helps them maintain a connection to Earth.

'The psychological benefits can be important for astronauts,' said NASA research scientist Trent Smith.

Besides - as many gardeners know - having a plot dry up or be devoured by mold isn't the end of world.

'The thing that the students learn is that making mistakes is okay,' said JoLynne Woodmansee, a teacher at BIOTech High School in Miami.

'The whole process of science is all about building. You can't learn something new without making a mistake.'