It is now well established that the neutron star (NS) merger is at the origin of the production of trans-iron heavy elements in the universe. These elements are therefore present in large quantities in the ejected matter, whose electromagnetic radiation, called kilonova, is characterized by a significant opacity due to the high density of spectral lines belonging to many heavy ions. Among these, the lanthanide ions play an essential role since, with their open 4f subshell, they have a considerable number of transitions that can absorb emitted light. The knowledge of the atomic structure and the radiative parameters of these ions as well as the determination of the corresponding opacities is therefore of paramount importance for the spectral analysis of kilonovae. The main goal of the present work is to determine the relative contributions of the different lanthanide elements to the opacity of the emission spectrum of a kilonova in its early phase, that is, a few hours after the NS merger, where the conditions are such that the temperature is between 25000 and 40000 K. At these temperatures, the lanthanide ions whose charge states are between V and VII are predominant. We used the pseudo-relativistic Hartree-Fock (HFR) method extensively to calculate the relevant atomic data (energy levels, wavelengths, and oscillator strengths) in La-Lu V-VII ions. The corresponding monochromatic opacities were estimated from the expansion formalism. We calculated the spectroscopic parameters for a total of more than 800 million radiative transitions in all the ions considered. These data were used to estimate the expansion opacities and Planck mean opacities for all the lanthanide elements at early-phase kilonova conditions between 25000 and 40000 K, making it possible to deduce the respective contributions of each element as a function of temperature. Atomic calculations were also carried out with the fully relativistic Multiconfiguration Dirac-Hartree-Fock (MCDHF) method in the specific case of the Yb V ion, as the available experimental data had not yet been compared with the theoretical calculations in our previous studies on lanthanide ions.