Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading native lib from python #85

Open
xvolks opened this issue Aug 21, 2023 · 3 comments
Open

Error loading native lib from python #85

xvolks opened this issue Aug 21, 2023 · 3 comments

Comments

@xvolks
Copy link

xvolks commented Aug 21, 2023

After install in a new venv with pip install python-olm==3.2.15

I get the message error symbol not found in flat namespace '__olm_error_to_string'

Tested with python 3.9, 3.10 and 3.11 on macOS 14.

❯ python
Python 3.10.12 (main, Jun 20 2023, 19:43:52) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import olm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Shared/bot/venv/lib/python3.10/site-packages/olm/__init__.py", line 24, in <module>
    from .utility import ed25519_verify, OlmVerifyError, OlmHashError, sha256
  File "/Users/Shared/bot/venv/lib/python3.10/site-packages/olm/utility.py", line 37, in <module>
    from _libolm import ffi, lib  # type: ignore
ImportError: dlopen(/Users/Shared/bot/venv/lib/python3.10/site-packages/_libolm.abi3.so, 0x0002): symbol not found in flat namespace '__olm_error_to_string'
@uhoreg
Copy link
Member

uhoreg commented Aug 21, 2023

Seems to work as expected on Linux. Strangely, _olm_error_to_string is only used internally, so there shouldn't be any linking errors.

Installing using libolm from brew, and older python package works, so there's something strange with the current build process on macOS.

@xvolks
Copy link
Author

xvolks commented Aug 21, 2023

As a temporary workaround @uhoreg told me to install:

brew install libolm
pip3 install python-olm==3.1.3 --global-option="build_ext" --global-option="--include-dirs="`brew --prefix libolm`"/include" --global-option="--library-dirs="`brew --prefix libolm`"/lib"

Remember to remove the version 3.2.15 if necessary.

It worked for me.

@NiTRoeSE
Copy link

NiTRoeSE commented Oct 12, 2023

I have the same issue on macOS 14 and python3.11 ( i dont have it tested with another python version):

brew install libolm
pip3 install matrix-nio


Traceback (most recent call last):
  File "/Users/nitro/Medialyse-Git/JSP Chat/main.py", line 10, in <module>
    from nio import AsyncClient, LoginResponse
  File "/Users/nitro/Medialyse-Git/JSP Chat/.jspchat_venv/lib/python3.11/site-packages/nio/__init__.py", line 9, in <module>
    from .client import *
  File "/Users/nitro/Medialyse-Git/JSP Chat/.jspchat_venv/lib/python3.11/site-packages/nio/client/__init__.py", line 3, in <module>
    from .base_client import Client, ClientConfig
  File "/Users/nitro/Medialyse-Git/JSP Chat/.jspchat_venv/lib/python3.11/site-packages/nio/client/base_client.py", line 36, in <module>
    from ..crypto import ENCRYPTION_ENABLED, DeviceStore, OutgoingKeyRequest
  File "/Users/nitro/Medialyse-Git/JSP Chat/.jspchat_venv/lib/python3.11/site-packages/nio/crypto/__init__.py", line 25, in <module>
    from .sessions import (  # isort:skip
  File "/Users/nitro/Medialyse-Git/JSP Chat/.jspchat_venv/lib/python3.11/site-packages/nio/crypto/sessions.py", line 21, in <module>
    import olm
  File "/Users/nitro/Medialyse-Git/JSP Chat/.jspchat_venv/lib/python3.11/site-packages/olm/__init__.py", line 24, in <module>
    from .utility import ed25519_verify, OlmVerifyError, OlmHashError, sha256
  File "/Users/nitro/Medialyse-Git/JSP Chat/.jspchat_venv/lib/python3.11/site-packages/olm/utility.py", line 37, in <module>
    from _libolm import ffi, lib  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: dlopen(/Users/nitro/Medialyse-Git/JSP Chat/.jspchat_venv/lib/python3.11/site-packages/_libolm.abi3.so, 0x0002): symbol not found in flat namespace '__olm_error_to_string'


The mentioned workaround didnt work for me:

pip3 install python-olm==3.1.3 --global-option="build_ext" --global-option="--include-dirs="`brew --prefix libolm`"/include" --global-option="--library-dirs="`brew --prefix libolm`"/lib"

Update: Same error with python3.8

Hope someone can help, thanks in advanced!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants