A search is underway for two men after a botched armed robbery in the southern Perth suburb of Shoalwater during which one of the men pepper sprayed his own face and the other cut himself.

It is alleged one of the men stole several items, including expensive sleep apnoea gear, from a pharmacy on Safety Bay Road early on Thursday night.

He was chased by the pharmacist and caught in the car park where he was joined by a second man.

One of them produced a knife and threatened the pharmacist; however, the ABC has been told by pharmacy staff the man accidentally cut himself.

One of the men then attempted to spray the pharmacist with pepper spray, but the canister was facing the wrong way and he ended up spraying himself in the face.

The men fled on foot and were last seen heading along Afon Avenue towards Frederick Street.

They are described as being aged between 18 and 21, fair skinned and of medium build.

The men were wearing black pants and black-hooded jumpers with dark grey sleeves.

Anyone with information is urged to contact police.