One good way to remove the Papacy from Rome, which both Franciscus Caesar "Italy, a destiny fulfilled"
TL and mine "A different 1866"
TL explore, is to have a stronger Italy win a victory as decisive in 1866 as the one of Prussia.
As a consequence, war between France and the Prussian-Italian alliance occurs in 1867-68 over Luxemburg and Rome. The Pope flees Rome and sets up shop in Avignon again, under French protection. The First Ecumenic Council occurs and a Second Western Schism occurs in the Cartholic Church. With the support of the German and Italian governments and nationalisms, the Old Catholics (which soon mold to resemble, and fuse with, the Episcopal Church) seize the allegiance of Germany and Italy, and Rome is lost for good to the Papacy.
The most likely outcome ("AD1866" takes this route) is that after the Commune convulsions, a reactionary-protofascist Bourbon monarchy is restored in France, and it supports a Carlist takeover in Spain during the Third Carlist War to establish a French-Spanish Ausgleich, and the Pope remains in Avignon, a pampered guest and propaganda token for the Bourbon regime.
However, if a Bourbon takeover is somehow prevented in France and Spain, and both countries remain liberla, the Pope may indeed relocate to Brazil instead, the next most natural conservative Catholic stronghold.