I personally think castration or just literally chopping off their penises is the best way. Because with this method, they won't have the chance to ever do that to others again. Why so harsh? Because rape victims get to live with the damage FOREVER, unlike robbery or others. I believe all people deserve second chances, but rapists should face that consequence of losing their members.
Although I woudln't recommend the same logic to other crimes like for theft, for example. I wouldn't agree that chopping their hands off is the proper way, because that is entirely different as they still have the chance to change and be productive citizens, etc. For rapists, well they can still function well without their penises, it's just that peeing would be different I guess. Moreover, I don't recommend death penalty to for any crime (because our justice system sucks and may just end up killing the wrong people)
I think it's funny that you have this selective concern about the justice system. You are worried that innocent people could be killed. What if innocent people have their penises chopped off? Some people may say they'd prefer to die than live without a penis.
I appreciate that you took a different stance on the issue though. Most people are talking about how punishments show scare people from raping others. You emphasized how amputating the penis would literally stop them from even repeating the crime. That may be more effective. I think it would have some bad side effects. I could imagine that some people would commit suicide. Some others may get very angry and commit worse crimes in the future.