NOVELTY - The gas is adsorbed in a first adsorber at a high pressure to produce a gas rich in smaller components G1, and the adsorber is then desorbed to produce a gas rich in larger components G2. The G2-rich gas then passes to a second adsorber at a higher pressure to produce a gas which is mainly G2. Desorption of the second adsorber produces a gas which is mainly G1.    USE - Elimination of carbon dioxide and/or nitrogen from a hydrocarbon flow such as natural gas.    ADVANTAGE - Low equipment cost for the elimination of nitrogen from natural gas allows exploitation of field which are currently not producing    DETAILED DESCRIPTION - Treating a fluid containing one or more components G2 with a kinetic diameter less than or equal to nitrogen and one or more components G1 with a kinetic diameter greater than or equal to methane comprises removing fluid from an adsorption stage in which a first flow F1 is obtained enriched in G1, operating at a high pressure P1, and with the G2 components mostly adsorbed in a first adsorption zone A1. The first adsorption zone then passes through a desorption phase at a pressure P2 to produce a second flow F2 enriched in G2. The second flow F2 is taken to a second adsorption zone A2 and adsorbed to produce a third flow F3 which is mainly G2, with the adsorption pressure near P2. Desorption of this second adsorption zone at a lower pressure P3 produces a flow F4 which is mainly G1. The ratio between P1/P2 is 1.5-5. P1 is 5-12 MPa, preferably 5-9 MPa. P2 is 2-8 MPa. P3 is 0.1-3 MPa. The absorption is carried out at a temperature of between -50 and +100 degrees C, preferably 0-70 degrees C. Part of the third flow F3 is used to purge the first adsorption zone after it has reached a suitable pressure. At least part of the flow F1 is used to purge the second adsorption zone after it has reached a suitable pressure. Installation for carrying out the above process.    DESCRIPTION OF DRAWING(S) - The figure shows a schematic view of the apparatus for the elimination of nitrogen and/or carbon dioxide from natural gas.