I found the problem. I had LD_LIBRARY_PATH set and it was picking up some libkrb5* libraries from there. After I removed that directory from LD_LIBRARY_PATH, import cv2 worked fine.