The correct usage is: "It takes (an amount)," but "two miles" is a distance. These are all examples of when you can use this expression:
- It takes an hour to get to Tokyo.
- It takes half a hectare to sustain a person.
- It takes a lot of love to raise a child.
- It takes a long time to improve your listening skills.