import chardet inside method otherwise install can fail