We present a study of electron-͑hole-͒ phonon interaction and polaron formation in semiconducting polymers within an extended Holstein model. A minimization of the lowest electronic state of this Hamiltonian with respect to lattice degrees of freedom yields the polaronic ground state. Input parameters of this Hamiltonian are obtained from ab initio calculations based on the density-functional theory. We calculate optical phonon modes and the coupling constants of these modes to the highest occupied and lowest unoccupied molecular orbital bands, respectively. For the studied polymers ͓polythiophene, poly͑phenylenevinylene͒, poly͑para-phenylene͔͒ the polaron binding energy, its size, and the lattice deformation as a function of conjugation length have been determined. Self-trapped polarons are found for long conjugation lengths. Energies of prominent PPV modes involved in polaron formation agree with infrared spectra. The polaron binding energies we find are much smaller than the width of the energy disorder in polymeric systems of practical importance, thus self-trapping effects can be ignored in practice.