Aims. Non-local thermodynamical equilibrium (non-LTE) line formation for singly-ionized and doubly-ionized praseodymium is considered for a range of effective temperatures between 7250 K and 9500 K. We evaluate the influence of departures from LTE on Pr abundance determinations and determine a distribution of the Pr abundance in the atmosphere of the roAp star HD 24 712 from a non-LTE analysis of the Pr ii and Pr iii lines. Methods. A comprehensive model atom for Pr ii/iii is presented based on the measured and the predicted energy levels, in total, 6708 levels of Pr ii and Pr iii and the ground state of Pr iv. Calculations of the Pr ii energy levels and oscillator strengths for the transitions in Pr ii and Pr iii are described.Results. The dependence of non-LTE effects on the atmospheric parameters is discussed. At T eff ≥ 8000 K, departures from LTE lead to the overionization of Pr ii and, therefore, to systematically depleted total absorption in the line and positive abundance corrections. At the lower temperatures, different lines of Pr ii may be either weakened or amplified depending on the line strength. The non-LTE effects strengthen the Pr iii lines and lead to negative abundance corrections. Non-LTE corrections grow with effective temperature for the Pr ii lines, and, in contrast, they decline for the Pr iii lines. The Pr ii/iii model atom is applied to determine the Pr abundance in the atmosphere of the roAp star HD 24 712 from the lines of two ionization stages. In the chemically uniform atmosphere with [Pr/H] = 3, the departures from LTE may explain only a small part (approximately 0.3 dex) of the difference between the LTE abundances derived from the Pr ii and Pr iii lines ( 2 dex). We find that the lines of both ionization stages are fitted for the vertical distribution of praseodymium, where the Pr enriched layer with [Pr/H] ≥ 4 exists in the outer atmosphere at log τ 5000 < −4. The departures from LTE for Pr ii/iii are strong in the stratified atmosphere and have the opposite sign for the Pr ii and Pr iii lines. The praseodymium stratification analysis of roAp stars has to be performed based on non-LTE line formation. Using the revised partition function of Pr ii and experimental transition probabilities, we determine the solar non-LTE abundance to be log (Pr/H) = −11.15 ± 0.08.