@Catherine Maria This will depend on where the asset is located. If you're in Los Angeles the rules are very strict and favorable for the tenant.
While the allure of an already rented asset is nice to have, you've encountered the downside of an asset with under market priced tenants.
It's too late now since you've purchased the building, but the typical process would be in your financial projections to account for removing the tenant at the end of the period, rehabbing the unit, and leasing the unit at market rent. Factoring this in will always give you your true cost of getting to market rents. And what you should pay for the asset. This is always your easy out for this current scenario regardless of the location.
As others have said, give them notice that you're rehabbing the units, they need to be out by X date, and run your business.
I will add that I have seen scenarios where tenant advocate representatives, and Courts go against the landlord when trying to remove tenants during the holiday season. You've got a little over a month before the Thanksgiving, Hanukkah, and Christmas season begins, hint hint!