Preheat oven to 350 degrees F (175 degrees C). Lightly grease a 2 quart casserole dish.
Bring a large pot of salted water to a boil. Add carrots and cook until tender, 15 to 20 minutes. Drain and mash. Stir in margarine, vanilla extract and eggs; mix well. Sift together flour, baking powder, salt and sugar; stir into carrot mixture and blend until smooth. Transfer to prepared casserole dish.