If you ever encounter an Octopus turn on your invisibility as soon as you can! If you don't the Octopus will steal whatever weapon you have in your hands and damage you, the only way to get it back is to kill the Octopus. Once you have turned on your invisibility you are free to attack the octopus without fear of losing your weapon.
If you don't have invisibility then you can try to either use barrels, timed bombs, or a grenade launcher to kill the Octopus, be careful to make sure you aren't directly in front, behind, above or below the Octopus or it will attack you and steal whatever you are holding.
If the Octopuses path is blocked by a block, then it cannot attack you.
Good luck, and happy Octopus hunting!