That's what happened to me. Before when I lost the weight, I lived in an apartment that had a gym. That wasn't hard because I could walk there in 5 minutes. Unfortunately, I hurt my ankle badly, and it interrupted my routine. I gained weight while healing up, which took forever.
The reason it took so long was because I couldn't miss work, and going to work required walking, which I limped to, and standing a lot at the convenience store.
I moved to two other apartments without a gym, and that didn't help. So I stopped working out. The more weight I gained, the less I felt comfortable working out around other people.