This paper generalizes Huangs cohomology theory of grading-restricted vertex algebras to meromorphic open-string vertex algebras (MOSVAs hereafter), which are noncommutative generalizations of grading-restricted vertex algebras introduced by Huang. The vertex operators for these algebras satisfy associativity but do not necessarily satisfy the commutativity. Moreover, the MOSVA and its bimodules considered in this paper do not necessarily have finite-dimensional homogeneous subspaces, though we do require that they have lower-bounded gradings. The construction and results in this paper will be used in a joint paper by Huang and the author to give a cohomological criterion of the reductivity for modules for grading-restricted vertex algebras