6

I read every manual and answers here, but still don't understand Pyinstaller's behavior.

I'd edited a .spec file where added my imports:

hiddenimports=['ftfy','sqlalchemy','mysql','pymysql','xlrd','xlwt','xlutils']

All of these packages were installed with pip.

Some interesting issues while Pyinstaller builds one-folder:

62573 INFO:   Found 4 sqlalchemy hidden imports
62577 WARNING: Hidden import "pysqlite2" not found!
62580 WARNING: Hidden import "MySQLdb" not found!
67597 WARNING: Hidden import "sqlalchemy.sql.functions.func" not found!
67623 INFO: Import to be excluded not found: 'sqlalchemy.testing'

sqlalchemy really uses other packages, in my project it's a mysql for connecting to MySQL DB. Every lib is in the default directory C:\Python\Lib\site-packages

  1. Why after dist is made I see nothing from my hiddenimport? Seems like statement doesn't really work. When I try run .exe:

    FileNotFoundError: [Errno 2] No such file or directory: 'D:\\rs_al\\IdeaProjects\\ExcelToSQL\\PyXLSQL\\dist\\service\\ftfy\\char_classes.dat'
    
    [1668] Failed to execute script service
    
  2. Shall I totally trust to pyinstaller analyzed dependencies? I use a small part of pandas and pyinstaller suggests to hook a numpypackage.

Rostislav Aleev
  • 351
  • 5
  • 19
  • This seems related to the fact that the library you are using is not bundling the .dat file because is not a python file. What you need is a custom hook to include this data in your final executable. – bvan Jul 05 '22 at 06:58

1 Answers1

0

This issue related to snowflake is common - be it NoModuleFound Error while executing the .exe file, or be it a Hidden import error during compilation.

Include the following 3 imports. It worked for me.

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from snowflake.sqlalchemy import URL

Please refer to this Stackoverflow page for more solutions: NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:snowflake

Aruparna Maity
  • 174
  • 3
  • 7