jaraco / keyring

MIT License
1.24k stars 152 forks source link

Keyring NoKeyringError on pyinstaller | onefile #591

Open idanless opened 2 years ago

idanless commented 2 years ago

Hi

I have centos 7 with Keyrings when I try do pyinstaller --onefile

i got this error below keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.

I read this error here but all the solutions for windows not working on Linux anyone have idea how to fix it ? is look like i need added the KWallet but dont know how

jaraco commented 2 years ago

Keyring provides a hook for pyinstaller that's expected to help pyinstaller detect the necessary imports to make to ensure the backends are loaded, so probably the backends are getting loaded, but no backend is suitable.

On Windows and Mac, the problem is pretty straightforward, because those two platforms provide a fairly uniform and simply way to store/retrieve credentials. On Linux, the story is much more complicated, where there are many competing options, none of which is an obvious best one.

Nevertheless, keyring does its best to detect any available backend and use it. Since you're getting the error, that suggests that none of the backends are suitable, so you probably need some additional dependencies present and injected into the installer/onefile.

Questions to be answered - what backend do you expect to be used? What backend is in use for your application when pyinstaller isn't present? What libraries does that backend depend on and are those libraries available in the pyinstaller? Can you inject those libraries into your pyinstaller?

I'd start by creating a pyinstaller project that only invokes keyring and use it to inspect the environment. Look at things like keyring.core.get_keyring().

Hope that helps.

AndreyNikiforov commented 1 year ago

solved same/similar issue by using pyinstaller --collect-all keyrings.alt --hidden-import pkgutil