Nature's Miracle or some other enzymatic cleaner will do the trick. Avoid all temptation to use Resolve or some other carpet/upholstery cleaner until you've followed the instructions on the enzyme cleaner. It's really tempting to use something to remove the stain right away, but if you're concerned about the odor, the enzyme cleaners are second to none.

I've got a cat with stomach issues (mostly controlled with steroids) and another who eats inanimate objects...we are vomit professionals. I've had my fair share of residents/fosters with other issues over the years, and the enzymatic cleaners are the only ones that really address the problem.

Although, if you're not renting, I highly recommend just getting rid of carpeting completely.