We report on an extensive study of the viscosity of liquid water at near-ambient conditions, performed within the Green-Kubo theory of linear response and equilibrium ab initio molecular dynamics (AIMD), based on density-functional theory (DFT). In order to cope with the long simulation times necessary to achieve an acceptable statistical accuracy, our ab initio approach is enhanced with deep-neural-network potentials (NNP). This approach is first validated against AIMD results, obtained by using the Perdew-Burke-Ernzerhof (PBE) exchange-correlation functional and paying careful attention to crucial, yet often overlooked, aspects of the statistical data analysis. Then, we train a second NNP to a dataset generated from the strongly-constrained and appropriately-normed SCAN-DFT functional. Once the error resulting from the imperfect prediction of the melting line is offset by referring the simulated temperature to the theoretical melting one, our SCAN DFT predictions of the shear viscosity of water are in very good agreement with experiments.