If in actual fact a Pope can never become a heretic, and the prayer of Jesus that the Faith of St. Peter may not fail (it did not fail, even when he externally denied Christ), which Tradition and Vatican I says is also applicable to his Successors, then the question of deposition doesn't arise. A Pope can be rebuked for making a mistake, like Pope John XXII was. But he will correct himself, or a Successor will correct him. Popes can make pretty tragic mistakes, like St. Bridget says about a Pope being lax on Clerical Celibacy. But a Successor will have to correct that. Our Lord gave it as a prayer, that the faith of St. Peter would not fail, that we too may pray for it.
It's a difficult and complicated question, but it's more likely, everything considered, that the prayer of Jesus Christ can never fail. But however that may be, a Pope can be rebuked whenever he is found, even without pertinacity, to have deviated from the Faith.