Skip to content

Add PyInstaller Hook to Collect Binaries#208

Open
Jjofalla wants to merge 1 commit into1Password:mainfrom
Jjofalla:bug/pyinstaller-missing-binaries
Open

Add PyInstaller Hook to Collect Binaries#208
Jjofalla wants to merge 1 commit into1Password:mainfrom
Jjofalla:bug/pyinstaller-missing-binaries

Conversation

@Jjofalla
Copy link

@Jjofalla Jjofalla commented Feb 7, 2026

When onepassword is imported, running an executable generated by PyInstaller (on Windows) will fail at runtime, unless the required binary op_uniffi_core.dll is manually added to a .spec file, or with the --add-binary flag. I believe this happens as the required .dll binary file is not automatically detected by PyInstaller.

Reproduction

pip install onepassword-sdk pyinstaller
echo "import onepassword" > test.py
pyinstaller test.py
./dist/test/test.exe

The resulting error:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import onepassword
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "pyimod02_importers.py", line 457, in exec_module
  File "onepassword\__init__.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "pyimod02_importers.py", line 457, in exec_module
  File "onepassword\client.py", line 5, in <module>
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "pyimod02_importers.py", line 457, in exec_module
  File "onepassword\core.py", line 14, in <module>
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "pyimod02_importers.py", line 457, in exec_module
  File "onepassword\lib\x86_64\op_uniffi_core.py", line 492, in <module>
  File "onepassword\lib\x86_64\op_uniffi_core.py", line 468, in _uniffi_load_indirect
  File "ctypes\__init__.py", line 471, in LoadLibrary
  File "pyimod03_ctypes.py", line 55, in __init__
pyimod03_ctypes.install.<locals>.PyInstallerImportError: Failed to load dynlib/dll 'C:..\\onepassword\\dist\\test\\_internal\\onepassword\\lib\\x86_64\\op_uniffi_core.dll'. Most likely this dynlib/dll was not found when the application was frozen.
[PYI-10644:ERROR] Failed to execute script 'test' due to unhandled exception!

Solution

This PR adds a PyInstaller hook hook-onepassword.py that collects required binaries so they are bundled automatically when building an executable. Build output confirms the hook is detected:

INFO: Processing standard module hook 'hook-onepassword.py' from 'C:...\\onepassword\\venv\\Lib\\site-packages\\onepassword\\pyinstaller_hooks'

This is not particularly urgent, but a nice to have!

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

@Jjofalla Jjofalla force-pushed the bug/pyinstaller-missing-binaries branch from f83cd27 to 4b8dd57 Compare February 7, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant