How to sign a PyInstaller exe
Install the tool with pip install bamboodeploy, build with PyInstaller, then run bamboo-sign sign dist\app.exe. The exe is scanned, signed and written back in place, and Windows shows a verified publisher instead of Unknown publisher. Signing, together with version info and no UPX, is the usual fix for the generic antivirus detections PyInstaller builds attract.
Why PyInstaller builds get flagged
- Every PyInstaller exe starts with the same bootloader, and so does malware packed with PyInstaller. Machine-learning engines learn that shape, so detections such as
Trojan:Win32/Wacatac.B!mlland on clean builds. The!mlsuffix marks a model's guess, not a known malware family. - A onefile build unpacks itself to a temporary folder and runs from there, which is also what many loaders do.
- UPX packing. If UPX is installed, PyInstaller uses it, and packers are among the strongest signals scanners look for.
- No version info and no signature leave an anonymous exe with nothing to tell it apart.
1. Install the tool and set your API key
pip install bamboodeploy
Create a key in the dashboard under API Keys. It starts with bd_live_. Save it for your Windows user, then open a new terminal so it sees the new variable:
setx BAMBOO_API_KEY bd_live_...
A .bamboorc file in your user folder with the line BAMBOO_API_KEY=bd_live_... works too.
The package is pure standard library, for Python 3.8 or newer, and does not need Node.
2. Build with version info and without UPX
pyi-grab_version writes a version file from any exe that has one, such as your Python's python.exe. Change every field to your own company, product and version, then pass the file to PyInstaller:
pyi-grab_version path\to\python.exe
pyinstaller --onefile --noupx --version-file file_version_info.txt app.py
Replace all of the copied values: a file that still names another company as its maker is refused for signing.
3. Scan, then sign
bamboo-sign scan dist\app.exe --fail-on-findings
bamboo-sign sign dist\app.exe
The scan is free and shows what antivirus engines see; --fail-on-findings stops a release script when it finds something. If bamboo-sign is not on PATH, python -m bamboodeploy sign dist\app.exe does the same.
onedir builds, Nuitka and cx_Freeze
In a onedir build, sign dist\app\app.exe and any extension modules or DLLs you compiled yourself. A python3XX.dll from a python.org install already carries the Python Software Foundation's signature. Nuitka and cx_Freeze builds are signed the same way: run bamboo-sign sign on the exe they produce. If you wrap the app in an installer, sign that as well; the Inno Setup guide covers the common case.
Smart App Control
On Windows 11 with Smart App Control on, a blocked program has no Run anyway button. Smart App Control lets a file with a valid signature run, and it checks every exe and DLL as it loads, not only the file the user downloaded. Sign the exe, the extension modules and DLLs you build, and the installer.
Common errors
bamboo-sign prints the reason and exits with one of these codes:
| Exit code | Meaning | What to do |
|---|---|---|
| 1 | Bad or missing API key, file not found, or signing denied or failed | Read the printed message. Check BAMBOO_API_KEY and the file path. |
| 2 | Signing needs a Premium plan | Upgrade in the dashboard. |
| 3 | Fewer than two verified connections | Verify your email plus a domain, GitHub or similar under Connections in the dashboard. |
| 4 | Timed out waiting for the signature | The build may be waiting for review. Run the same command again once it is approved. |
FAQ
Should I switch from PyInstaller to Nuitka?
Nuitka compiles to C, so its output looks different to scanners, but an unsigned Nuitka build can still be flagged. Sign whichever you use.
Does reporting a false positive to Microsoft fix it?
It clears that one file. The next build has a new hash and can be flagged again, while the publisher in a signature stays the same from build to build.
Does it work in GitHub Actions?
Yes. Run pip install bamboodeploy in the job, set BAMBOO_API_KEY from a secret, and call bamboo-sign sign after pyinstaller.
Whose name does Windows show as the publisher?
Ours. We sign your build with our EV code signing certificate, so Windows shows our verified publisher name instead of Unknown publisher. You need no certificate, company registration or USB token of your own.
Does signing remove the SmartScreen warning at once?
Not on its own. A valid signature replaces Unknown publisher with a verified publisher, and Smart App Control lets a signed file run. SmartScreen also weighs reputation, which builds as people download and run your files, and no certificate grants it instantly, EV included. See EV certificates no longer skip SmartScreen.
What do I need before I can sign?
A Bamboo Deploy account, an API key from the dashboard, a Premium plan and two verified connections: your email plus a domain, GitHub or similar. Uploading and scanning are free.
Bamboo Deploy scans every build and signs it with our EV certificate, so you need no certificate, no company registration and no USB token of your own. Get started, or read the docs.