Keeper-Security / Commander

Keeper Commander is a python-based CLI and SDK interface to the Keeper Security platform. Provides administrative controls, reporting, import/export and vault management.
https://www.keepersecurity.com/commander.html
MIT License
182 stars 74 forks source link

ImportError: DLL load failed while importing _core: The specified module could not be found #1209

Closed ChristofferLB closed 3 months ago

ChristofferLB commented 3 months ago

Hi,

I'm using the Keeper Commander Python SDK in an automation runbook in Azure. It was working correctly until a few days ago.

Now I get the following error:

Traceback (most recent call last): File "/usr/src/tmp/b27fs3b0-6287-4133-b166-3dc8a9f493c3/runbooks/CredentialDistribution.py", line 4, in <module> from keepercommander.__main__ import get_params_from_config File "C:\userenv\lib\site-packages\keepercommander\__main__.py", line 27, in <module> from . import cli File "C:\userenv\lib\site-packages\keepercommander\cli.py", line 44, in <module> register_commands(commands, aliases, command_info) File "C:\userenv\lib\site-packages\keepercommander\commands\base.py", line 117, in register_commands from . import discoveryrotation File "C:\userenv\lib\site-packages\keepercommander\commands\discoveryrotation.py", line 45, in <module> from .tunnel.port_forward.endpoint import establish_symmetric_key, WebRTCConnection, TunnelEntrance, READ_TIMEOUT, \ File "C:\userenv\lib\site-packages\keepercommander\commands\tunnel\port_forward\endpoint.py", line 13, in <module> from aiortc import RTCPeerConnection, RTCSessionDescription, RTCConfiguration, RTCIceServer File "C:\userenv\lib\site-packages\aiortc\__init__.py", line 4, in <module> import av.logging File "C:\userenv\lib\site-packages\av\__init__.py", line 12, in <module> from av._core import time_base, library_versions ImportError: DLL load failed while importing _core: The specified module could not be found.

No changes were performed between when it was working to now when it's not working. The only think I can think of is that there was an update to a newer version of Python 3.8 by Microsoft.

Versions of modules.

aioice 0.9.0 aiortc 1.6.0 asciitree 0.3.3 av 11.0.0 azure_core 1.29.5 azure_identity 1.15.0 azure_mgmt_automation 1.0.0 azure_mgmt_core 1.4.0 colorama 0.4.6 dnspython 2.4.2 google 3.0.0 google_api_core 2.15.0 google_api_python_client 2.111.0 googlecrc 1.5.0 ifaddr 0.2.0 importlib_metadata 7.0.0 keeper 16.6.2 keepercommander 16.9.29 msal 1.26.0 pip 23.3.1 prompt_toolkit 3.0.43 protobuf 4.25.1 pycryptodomex 3.19.0 pyee 11.1.0 pylibsrtp 0.9.1 pyperclip 1.8.2 tabulate 0.9.0 typing_extensions 4.9.0 wcwidth 0.2.12 zipp 3.17.0

I have tried to update Keeper Commander to 16.8.29 and Keeper Secret Manager to 16.6.2. I've also tried to upgrade and downgrade av.

Any idea how I can fix it?

sk-keeper commented 3 months ago

Commander installs aiortc package if running on Python 3.8 or later. https://github.com/Keeper-Security/Commander/blob/1aa77122b3a54d2b1ab2c43a22668beccf231be4/requirements.txt#L22

aiortc depends on av package which uses native libraries. Those libraries cannot be loaded. It looks like av module tries to load Windows DLL. The first line in your stacktrace used UNIX filenames

File "/usr/src/tmp/b27fs3b0-6287-4133-b166-3dc8a9f493c3/runbooks/CredentialDistribution.py", 

Probably Windows libraries have not been installed. The reference to aiortc was added to Commander v16.9.28.

pip install keepercommander==16.9.26

We will try to duplicate and fix this issue with Azure automation runbook.

ChristofferLB commented 3 months ago

Hi,

Sorry for a late reply.

I downgraded to 16.9.26 and it works fine now, thanks! It would be great if it can be fixed, but until then I'm fine using the slightly older version.