Preparation is key
The best thing to do is test, test, test.
My group built a thermal/vac chamber for testing individual components, and eventually put the whole assembled instrument inside one of NASA's huge thermal/vac chambers (the kind normally used for testing rockets).
Even still, during the middle of our flight one of our batteries failed due to over-charging. It turned out we had more solar power than our charge controller could manage. Thankfully the instrument was on a rotator so we could angle the panels away from the sun.
Power is Heat
Any talk of power in a near-vacuum environment is incomplete without considering your thermal model. The RPi's CPU gets warm to the touch in my office, which means if you take away all that convection from the air it's going to get VERY HOT.
An easy generic solution, is to enclose the whole thing in a metal box, and attach the box to a radiator with a large area (the box itself may be sufficient). You want to point this radiator at black space, and shade it from the sun or earth/snow albedo. For specific trouble spots (i.e. the CPU) add a low-thermal-impedance path such as a thick copper braid between it and your radiator.
Finally, you gain thermal efficiency by coating your metal radiators (including the inside of enclosures) with a good thermal conductive white paint.
Battery alternatives
Capacitors
Depending on your ampere-hours, you might be able to get away with capacitors instead of batteries. This will save weight and possibly lessen your thermal load in general. But be aware that ultra- and super-capacitors are a niche product already, and finding space-rated ones may be ...difficult. :)
Solar Panels
Can you get away with no batteries at all? Maybe your weight and power budgets will let you use solar power exclusively. The biggest trade-off here is between providing enough power in the worst case vs. getting rid of excess power in the best case.