I solved this by adding the Crypto directory tree to the spec file
I get the path using this function:
def get_crypto_path(): '''Auto import sometimes fails on linux''' import Crypto crypto_path = Crypto.__path__[0] return crypto_path
And then replace in the spec file:
dict_tree = Tree('CRYPTO_PATH', prefix='Crypto', excludes=["*.pyc"]) a.datas += dict_tree
source share