Heat gun and scraper.
Scraping and pulling up. Long handle carpe scrapers are sold at Home Depot, Lowes, and Menards.
This article walks you through how to do it.
A scraper is the only way I know.
Scraper is best, if you use a heat gun you can just make a bigger mess if carpet as it could melt.