To remove paint primer from carpet, the best solution is to buy a product made for this purpose, such as Motsenbocker's Lift Off #5. If there is no commercial product on hand, a more traditional method is to mix a teaspoon of mild, non-bleaching detergent with a cup of warm water, blot the stain, sponge with clean water, and blot the stain again.
To remove a major spill of primer that has dried, physically snip as much of the primer as possible with a scissors or pliers without leaving a bald spot in the rug. Then vacuum the fiber debris and apply a water-soluble paint and varnish remover, sold at hardware stores and paint stores.
Before applying the stain remover, test a small area in a corner of the stain. If it seems effective, apply the product to the entire stained area, working from the outside edges toward the center. This prevents the stain from seeping outward, as it would if the remover were applied from the middle toward the edges. If the stain remover is successful, the primer will soften into a gummy substance which can be scooped away with a butter knife. Protect the surrounding area of the carpet with rags weighted down with flat objects.