remove redundant flow import and move scipy importerror handling