Perhaps the single thing that brought the need for electricity in space to the public's attention was NASA's Apollo 13 mission, or for later generations the cinema production based on the mission, Apollo 13. In that near-disaster, the crew would have died had the mission lasted longer than it had due to the constraints of their batteries. Today, solar power is considered among the best sources for electricity in Earth orbit. Soon after that, it becomes impractical. Producing this by solar panels near Mars would require 68,000 square meters of solar panel-hardly practical.
Fossil fuels are certainly out of the question, leaving few alternatives to nuclear power.
Ever since the Cold War and such nuclear power disasters such as Chernobyl in Ukraine, nuclear power has carried with it a connotation of disaster and ruin. However, most nuclear power plant disasters have been caused by poor design coupled with poorly trained operators. A nuclear reactor could be safely assembled in space far from human lives, leaving just the finished product to be installed into the spacecraft. We may be on the brink of a revolution in space flight. Humans may soon be walking on our second planet other than Earth.