5 gallons is definitely too small for pairs. For pairs, you need a minimum of 15 gallons, preferably 20. It really doesn't matter, though. It's not like they'll benefit from being in pairs. In fact, their lifespans might actually shorten from the stress of being near each other. The only benefit they get from being in pairs is enhanced colouration because they will constantly try to breed. So no, you don't need pairs unless you want to see peak colouration, although you'll still see good colours without pairs. And if you keep them in groups, do a ~5+ females that were raised together when they were younger. If you want multiple in a 5g, consider Channoides or Albimarginata.