'How to fix ModuleNotFoundError: No module named 'reportlab.graphics.barcode.code93' in pyinstaller?

I am converting a python file to .exe using pyinstaller v5.0.1, but I got this error when I run the exe file:

ModuleNotFoundError: No module named 'reportlab.graphics.barcode.code93'

Note that the python file is working perfectly and I'm not even using code93 in my code.



Solution 1:[1]

I have fixed this issue by adding an import for all this libs even if I don't use them:

from reportlab.graphics.barcode import code93
from reportlab.graphics.barcode import code39
from reportlab.graphics.barcode import usps
from reportlab.graphics.barcode import usps4s
from reportlab.graphics.barcode import ecc200datamatrix

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Coso