Path-integral Monte Carlo methods were applied to calculate the second, B(T), and the third, C(T), virial coefficients for water. A fully quantum approach and state-of-the-art flexible-monomer pair and three-body potentials were used. Flexible-monomer potentials allow calculations for any isotopologue; we performed calculations for both H2O and D2O. For B(T) of H2O, the quantum effect contributes 25% of the value at 300 K and is not entirely negligible even at 1000 K, in accordance with recent literature findings. The effect of monomer flexibility, while not as large as some claims in the literature, is significant compared to the experimental uncertainty. It is of opposite sign to the quantum effect, smaller in magnitude than the latter below 500 K, and varying from 1% at 300 K to 10% at 700 K. When monomer flexibility is accounted for, results from the CCpol-8sf pair potential are in excellent agreement with the available experimental data and provide reliable B(T) at temperatures outside the range of experimental data. The flexiblemonomer MB-pol pair potential yields B(T) that are slightly too high compared to experiment. For C(T), our calculations confirm earlier findings that the use of three-body potential is necessary for meaningful predictions. However, due to various uncertainties of the potentials used, especially the three-body ones, we were not able to establish benchmark values of C(T), although our results are in qualitative agreement with available experimental data. The quantum effect, never before included for water, reduces the magnitude of the classical value for H2O by a factor of 2.5 at 300 K and is not entirely negligible even at 1000 K.