Tribler/py-ipv8

Validation action doesn't install OS-level libsodium

qstokkink opened this issue · 2 comments

Validation works just fine on ubuntu-latest. However, Windows and Mac still fail, causing other runners to cancel.

screenshot1

screenshot2

On Windows:

Run python run_all_tests.py -a
Traceback (most recent call last):
  File "D:\a\py-ipv8\py-ipv8\run_all_tests.py", line 261, in <module>
    test_class_names = find_all_test_class_names()
  File "D:\a\py-ipv8\py-ipv8\run_all_tests.py", line 246, in find_all_test_class_names
    test_class_names.extend(derive_test_class_names(found_test))
  File "D:\a\py-ipv8\py-ipv8\run_all_tests.py", line 230, in derive_test_class_names
    module_instance = importlib.import_module(module_name)
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "D:\a\py-ipv8\py-ipv8\ipv8\test\test_community.py", line 6, in <module>
    from ..community import Community, CommunitySettings
  File "D:\a\py-ipv8\py-ipv8\ipv8\community.py", line 21, in <module>
    from .lazy_community import EZPackOverlay, lazy_wrapper, lazy_wrapper_unsigned
  File "D:\a\py-ipv8\py-ipv8\ipv8\lazy_community.py", line 7, in <module>
    from .keyvault.crypto import default_eccrypto
  File "D:\a\py-ipv8\py-ipv8\ipv8\keyvault\crypto.py", line 9, in <module>
    from .private.libnaclkey import LibNaCLSK
  File "D:\a\py-ipv8\py-ipv8\ipv8\keyvault\private\libnaclkey.py", line 1, in <module>
    import libnacl
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\libnacl\__init__.py", line 87, in <module>
    nacl = _get_nacl()
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\libnacl\__init__.py", line 36, in _get_nacl
    raise OSError(msg)
OSError: Could not locate nacl lib, searched for libsodium
Error: Process completed with exit code 1.

On Mac:

Run python run_all_tests.py -a
Launching in 8 processes ... awaiting results ... test suite process crash! Segfault?

======================================================================

======================================================================
Summary:
[FAILED] Ran 0 tests in 0.0 seconds (0 seconds total in tests).
Error: Process completed with exit code 1.

At least the Windows failure relates to libsodium not being installed next to the Python dependencies. The Mac failure is assumed to be the same. Our own docs show what should be run.

The Tribler workflow shows how this can be done: https://github.com/Tribler/tribler/blob/main/.github/workflows/pytest.yml

I'm contemplating a python-cryptography-based workaround to implement LibNaCLSK and LibNaCLPK (ref).

The cryptography-based workaround works for Windows (implemented in #1225). However, MacOS still mysteriously crashes.