2 and 3 for me. Although I enjoyed Marseille, Genoa and La Spezia very much, I find Gibraltar underwhelming, plus all the sea days are at the beginning of the week. Weeks 2 & 3 have an interesting mix of ports and you get a sea day towards the end of week 3 which definitely helps when it comes to packing! Plus you could then stay on a few days in Barcelona.
whichever you decide is right for you, I hope you enjoy visiting Europe