FlorianREGAZ / Python-Tls-Client

Advanced HTTP Library
MIT License
679 stars 135 forks source link

ARM support #13

Closed kotx closed 1 year ago

kotx commented 1 year ago
  File "/home/kot/.local/share/virtualenvs/chatGPT-discord-bot-BNM29DVl/lib/python3.11/site-packages/revChatGPT/revChatGPT.py", line 4, in <module>
    import tls_client
  File "/home/kot/.local/share/virtualenvs/chatGPT-discord-bot-BNM29DVl/lib/python3.11/site-packages/tls_client/__init__.py", line 15, in <module>
    from .sessions import Session
  File "/home/kot/.local/share/virtualenvs/chatGPT-discord-bot-BNM29DVl/lib/python3.11/site-packages/tls_client/sessions.py", line 1, in <module>
    from .cffi import request
  File "/home/kot/.local/share/virtualenvs/chatGPT-discord-bot-BNM29DVl/lib/python3.11/site-packages/tls_client/cffi.py", line 15, in <module>
    library = ctypes.cdll.LoadLibrary(f'{root_dir}/dependencies/tls-client{file_ext}')
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kot/.asdf/installs/python/3.11.0/lib/python3.11/ctypes/__init__.py", line 454, in LoadLibrary
    return self._dlltype(name)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/kot/.asdf/installs/python/3.11.0/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: /home/kot/.local/share/virtualenvs/chatGPT-discord-bot-BNM29DVl/lib/python3.11/site-packages/tls_client/dependencies/tls-client-amd64.so: cannot open shared object file: No such file or directory

arch is aarch64, amd64 will not work here.

Kidsan commented 1 year ago

Have the exact same problem. tls_client/cffi.py needs to be extended to support raspberry pi 4 (platform = "linux" and machine = "armv7l") and we need the appropriate shared object in the dependencies directory.

maxoyed commented 1 year ago

same problem, there is no .so file for arm64 in dependencies folder

crackedpotato007 commented 1 year ago

Same here

Kidsan commented 1 year ago

I've opened a PR that hopefully resolves this. Would be great if people can confirm this works for them to make it easier to merge.

0xRaduan commented 1 year ago

for my use-case a fix was to use this image: FROM --platform=amd64 python:3.9-slim instead of default docker one, but in case you want to start it only in a particular architecture, it would be great to have bigger support

crackedpotato007 commented 1 year ago

@Kidsan Raspberry has officially moved to arm64

Kidsan commented 1 year ago

@arnav7633 interesting, I knew it was possible but hadn't known that it was a fully adopted architecture. I'm running 32bit on my Pis and I'm quite ignorant to this stuff. Do you know if it returns aarch64 if we call platform.machine() or armv8b or what? Perhaps we need to account for multiple variations.

crackedpotato007 commented 1 year ago

Its aarch64. More info here

FlorianREGAZ commented 1 year ago

I've pushed an update, please lmk if this resolves your issues