V.~A.~Vassiliev On invariants and homology of spaces of knots in arbitrary manifolds The construction of finite-order knot invariants in $\R^3$, based on resolutions of discriminant sets, can be carried over immediately to the case of knots in an arbitrary three-dimensional manifold $M$ (maybe nonorientable) and, moreover, to the calculation of cohomology groups of spaces of knots in arbitrary manifolds of dimension $\ge3$. Obstructions to the integrability of admissible weight systems to well-defined knot invariants in $M$ are identified as $1$-dimensional cohomology classes of certain generalized loop spaces of $M$. Unlike the case $M=\R^3$, these obstructions can be nontrivial and provide invariants of the manifold $M$ itself. The corresponding algebraic machinery allows us to obtain on the level of ``abstract nonsense'' some of the results and problems of theory, and to extract from others the essential topological (in particular, low-dimensional) part.