You need to mimic the process through chemistry.
Why on earth (or in space) would you do that? A couple tons of chemical laboratory, and all you get is glucose.
A few hundred pounds of seed and fertilizers an you get sugars, starches, fiber, fuel, vitamins and oxygen. You get pasta, potatoes, tomatoes, cotton, peppers, corn, berries, salad greens, eventually fruits and nuts. and if for whatever reason, blueberries fail, its not a disaster, you still have strawberries, raspberries, blackberries, etc.
With your chemical factory all you get is sugar water, and if the equipment of any step of the process including the side steps making the chemical feedstocks breaks, you are done.