Search code examples
python-3.xpythonista

Why didn't I receive cryptography.hazmat.bindings._padding when installing cryptography with StaSh?


I am using Pythonista for iOS and installed the cryptography package using the latest version of StaSh. It looked like there was an issue during installation but it still seemed to be successful:

Extracting archive file ...
Archive extracted.
Running setup file ...
TypeError('expected string or bytes-like object',)
Failed to run setup.py
Fall back to directory guessing ...
Package installed: cryptography

However, when I try to import Fertnet from cryptography.fertnet I get a ModuleNotFoundError. Apparently I'm missing cryptography.hazmat.bindings._padding. Does anyone have any idea why I'm not getting that module?


Solution

  • The cryptography module is partly written in C. Those parts have to be compiled into shared libraries. The libraries are named _constant_time, _openssl and _padding and they should be located in hazmat/bindings.

    AFAICT PyPI only carries compiled packages for linux, windows and macOS but not for IOS. So my guess is that setup.py fails because it cannot compile those libraries.