Unfortunately, many of the ports that these ships visit have laws regarding allowing an armed ship from entering the harbor. An armed ship may be construed as a military ship, and therefore makes the commercial harbor a military target.
That is the only reason, IMHO, that the ships have been unarmed for so long - they haven’t had the right to self-defense.