The Maxwell-Boltzmann distribution of molecular velocities and densities was derived first in the 1870s, but the derivations were difficult to follow and led to predictions of the heat capacities of gases that did not agree with experiment. The systems discussed were molecules or assemblies of molecules to which a definable energy could be ascribed, the equivalent of the microcanonical ensemble of Gibbs. This led to complications when dense gases and liquids were considered, and so, for the next thirty years, to arguments about the validity of the derivations. In principle these complications can be removed most simply by considering a set of systems of fixed temperature, or a canonical ensemble. It was, however, many years before most textbooks followed Gibbs down this route.