Repository navigation
PyInstaller not supported #837
Replies: 2 comments
|
PyInstaller usually doesn't pick up everything mssql-python needs on its own. The package ships native parts ( Try telling PyInstaller to grab both packages completely: (or the same thing as |
|
This is a packaging problem, not a limitation of
pyodbc works because it's a plain extension module, and it uses the ODBC Driver 18 you installed system-wide. Bundle both explicitly (PowerShell, inside the venv you build from): $pyd = python -c "import glob, importlib.util, os; d = os.path.dirname(importlib.util.find_spec('mssql_python').origin); print(glob.glob(os.path.join(d, 'ddbc_bindings.*.pyd'))[0])"
pyinstaller --onefile --windowed --clean --noupx `
--collect-all mssql_python `
--collect-all mssql_python_odbc `
--add-binary "$pyd;mssql_python" `
Desktop_GUI_app.py
I checked the same thing on Linux with mssql-python 1.15.0 and PyInstaller 6.22. A plain If you use a from PyInstaller.utils.hooks import collect_all
import glob, importlib.util, os
datas, binaries, hiddenimports = [], [], []
for pkg in ("mssql_python", "mssql_python_odbc"):
d, b, h = collect_all(pkg)
datas += d; binaries += b; hiddenimports += h
pkg_dir = os.path.dirname(importlib.util.find_spec("mssql_python").origin)
binaries += [(p, "mssql_python") for p in glob.glob(os.path.join(pkg_dir, "ddbc_bindings.*.pyd"))]
# pass datas / binaries / hiddenimports to Analysis(...)Longer term, a hook in |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello community, I developped a Desktop GUI application (with tkinter) that connects to a SQL Server database through ODBC Driver 18. I use pyodbc for that matter, and PyInstaller to create the executable from the Python script file, and it always works.
But when I wanted to switch to mssql-python, the EXE created could not even open, and the unhandled exception [WinError 3] error message states that the system cannot find the path specified of mssql_python, so I switched back to pyodbc.
My OS: Windows 11
My Python version: 3.14.8 (soon 3.15.0)
My command: pyinstaller --onefile --windowed --clean --noupx Desktop_GUI_app.py
Any ideas?
All reactions