Python3 snap: Can't load cryptoauthlib

I’m trying to test out some crypto hardware on a device, and I need to make it a snap to run on Core18. I’ve managed to get a snap to build and install, but it’s throwing errors when it runs.

Traceback (most recent call last):
  File "/snap/crypto-test/x1/bin/", line 6, in <module>
    from cryptoauthlib import *
  File "/snap/crypto-test/x1/lib/python3.6/site-packages/cryptoauthlib/", line 16, in <module>
  File "/snap/crypto-test/x1/lib/python3.6/site-packages/cryptoauthlib/", line 83, in load_cryptoauthlib
    _CRYPTO_LIB = ctypes.cdll.LoadLibrary(os.path.join(curr_path, ""))
  File "/snap/crypto-test/x1/usr/lib/python3.6/ctypes/", line 426, in LoadLibrary
    return self._dlltype(name)
  File "/snap/crypto-test/x1/usr/lib/python3.6/ctypes/", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /snap/crypto-test/x1/lib/python3.6/site-packages/cryptoauthlib/ undefined symbol: hid_open

I’ve tried including a whole slew of stuff in the snap to try to solve this with no success. Here is my part from snapcraft.yaml

    source: .
    plugin: python
    python-version: 'python3'
        - cryptoauthlib
        - hidapi
        - setuptools
        - libusb-dev
        - libhidapi-dev
        - libusb-1.0-0

Here is my

    install_requires=['cryptoauthlib', 'hidapi'],

I’m building on a RasPi 4 targeting an armhf device.

Has anyone tried to use cryptoauthlib in a snap before? How does one solve this issue? Best guess right now is that I’m missing some kind, variety, or flavor of a hid library.

you probably want to make the first two build-packages: instead of stage-packages:

I’ve tried them in both positions, to no avail, but yea I guess those probably should be in build :smile:

The website mentions some packages you don’t have here for building:

and there seems to be a caching issue if you did not build correctly initially, (try snapcraft clean crypto-test which essentially wipes the cache)

1 Like

Interesting. Guess I need to RTFM more. Trying it out now…

EDIT: No dice :c

What on earth am I missing? It’s gotta be some dumb hid library or something, right?