Where have you got 5 inches from.
Control
Non-chemical control
Sow sparsely to avoid thinning the seedlings. Female carrot flies searching for egg-laying opportunities are attracted by the smell released when surplus plants are removed
Late sown carrots (after mid-May) avoid the first generation of this pest; similarly carrots harvested before late August avoid the second generation
Protect vulnerable crops by surrounding them with 60cm (2ft) high barriers made of clear polythene to exclude the low-flying female flies, or cover the plants with insect-proof netting, such as Enviromesh.