Skip to content

Tiktoken is for EM_X86_64 | ImportError: dlopen failed () #3050

Description

@sensoryfox

The issue is indeed a bug and not a support request.
I have a short, runnable example that reproduces the issue.
I used the grave accent (aka backticks) to format code or logs when appropriated.

Versions

  • Python: 3.11.5
  • OS: Ubuntu
  • Kivy: 2.3.0
  • Cython: 3.0.11

Description

I'm trying to use the tiktoken library in my Android app built with Python-for-Android. After building the APK and running it on my device, I get the following error:
ImportError: dlopen failed: "/data/data/org.test.sensory_app/files/app/_python_bundle/site-packages/tiktoken/_tiktoken.so" is for EM_X86_64 (62) instead of EM_AARCH64 (183)

This error means that the _tiktoken.so library, which is a native library compiled for ARM64 architecture, is not compatible with my device's architecture (ARM64). It seems like the library was compiled for x86_64 instead of ARM64.

I believe that a recipe for tiktoken is needed to properly build and install it for Android.

buildozer.spec
Command:
buildozer android debug

Spec file:
[app]
title = SensoryContext
package.name = sensory_app
package.domain = org.test
android.private_storage = True
source.dir = .
source.includes = Plugin/*
version = 0.1
source.include_exts = json
entrypoint = main.py
requirements = python3,kivy,kivymd,setuptools-rust>=1.5.2,setuptools>=62.4,python-telegram-bot>=21.4,openai,httpx,pillow,pydub,tenacity,sniffio,httpcore,h11,trio,socksio,regex>=2022.1.18,requests>=2.26.0, tiktoken
android.permissions = INTERNET,WRITE_EXTERNAL_STORAGE
android.ndk = 25b
android.ndk_api = 21

android.archs = arm64-v8a
android.cflags = -Wno-cast-function-type-strict

[buildozer]
log_level = 2
warn_on_root = 1

I would be very grateful if you could create a recipe for tiktoken to solve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions