I did not stay in Montmartre while in Paris, but I was in the neighborhood several nights (including one late night) walking on my own and did not feel unsafe. In the Pigalle area, there are stripper clubs and porn shops - but not really any more than what you might see in a big North American city.
I saw some gypsies hanging around Sacre Couer and the base of the funicular during the daytime when there are loads of tourists they can approach, but most of them vanish when the tourists are gone for the day. Overall, Montmartre is a nice area with cute bistros and cafes and pretty side streets. I would not be hesitant to stay there in a hotel.