Specification and tuning of errors from dynamical models are important issues in data assimilation. In this work, we propose an iterative expectation–maximization (EM) algorithm to estimate the model‐error covariances using classical extended and ensemble versions of the Kalman smoother. We show that, for additive model errors, the estimate of the error covariance converges. We also investigate other forms of model error, such as parametric or multiplicative errors. We show that additive Gaussian model error is able to compensate for non‐additive sources of error in the algorithms we propose. We also demonstrate the limitations of the extended version of the algorithm and recommend the use of the more robust and flexible ensemble version. This article is a proof of concept of the methodology with the Lorenz‐63 attractor. We developed an open‐source Python library to enable future users to apply the algorithm to their own nonlinear dynamical models.