try importing matplotlib first.