Yes a poor cannot be deposed. However should the pope fall into formal heresy, he is no longer a catholic and only a catholic can be pope.
Thus in this situation he can be deposed. However, or rather shown to be in error and declared to be deposed if he loses he refuses to recant of his error or heresy.
John of St. Thomas, Suarez, Cajetan, and others eminent teachers of the faith all teach that a general council alone would be the competent authority to oversee the matter of an heretical Pope. John of St. Thomas explained why. He wrote:
“since the matter at hand concerns the universal Church, it must be overseen by the tribunal that represents the universal Church, which is that of a general council
He cites three historical examples to confirm the point:
*“This is indeed evident from the practice of the Church, for in the case [Pope] Marcellinus, who offered incense to idols, a synod was gathered together for the purpose of discussing this case, as is recorded in Cap. Hunc c, distinct. 11. And in the case of the schism in which there were three reputed pontiffs, the Council of Constance gathered for the purpose of settling that schism. And also in the case of Pope Symmachus, a council at Rome was gathered to treat those things which were presented to it. It is known, from the resources cited above, that the pontiffs, who, being accused of various crimes and wanting to excuse themselves of charges, did so in the presence of a council.” *