  This Letter reports the first measurement of prompt $\chi_{c1}$ and
$\chi_{c2}$ charmonium production in nuclear collisions at LHC energies. The
cross-section ratio $\sigma(\chi_{c2}) / \sigma(\chi_{c1})$ is measured in
$p$Pb collisions at $\sqrt{s_{NN}}$ = 8.16 TeV, collected with the LHCb
experiment. The $\chi_{c1,2}$ states are reconstructed via their decay to a
$\rm{J}/\psi$ meson, subsequently decaying into a pair of oppositely charged
muons, and a photon, which is reconstructed in the calorimeter or via its
conversion in the detector material. The cross-section ratio is consistent with
unity in the two considered rapidity regions. Comparison with a corresponding
cross-section ratio previously measured by the LHCb collaboration in $pp$
collisions suggests that $\chi_{c1}$ and $\chi_{c2}$ states are similarly
affected by nuclear effects occurring in $p$Pb collisions.
