Skip to content

RuntimeError: failed to get api PyCell_Get #3060

Closed

Description

@GvozdevLeonid

Versions

  • Python:3.11.5
  • OS:Android
  • Kivy:2.3.0
  • Cython:0.29.36
  • OpenJDK: do not know

Description

The current version of the interpreter does not support the full list of python api. I checked that the Py_LIMITED_API flag is not set, but some functions are not available for some reason

start.c

...
LOGP("Initializing Python for Android");
#ifdef Py_LIMITED_API
    LOGP("Py_LIMITED_API is defined");
    LOGP(Py_LIMITED_API);
#else
    LOGP("Py_LIMITED_API is not defined");
#endif

#ifdef PY_VERSION_HEX
    LOGP("PY_VERSION_HEX is defined");
    LOGP(PY_VERSION_HEX);
#else
    LOGP("PY_VERSION_HEX is not defined");
#endif

#ifdef PyCell_Get
    LOGP("PyCell_Get is defined");
#else
    LOGP("PyCell_Get is not defined");
#endif
...

buildozer.spec

Command:

buildozer android debug

Spec file:

[app]

title = Test

package.name = Test

package.domain = org.test

source.dir = .

source.include_exts = py,png,jpg,kv,atlas,so

source.exclude_dirs = tests, bin, venv

version = 1

requirements = python3,hostpython3,kivy,libffi

orientation = portrait, landscape, portrait-reverse, landscape-reverse

fullscreen = 1
android.api = 31
android.ndk = 25b

android.permissions = INTERNET,MANAGE_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE,READ_EXTERNAL_STORAGE,ACCESS_FINE_LOCATION,ACCESS_COARSE_LOCATION

android.release_artifact = apk

android.manifest.orientation = fullSensor

android.archs = armeabi-v7a, arm64-v8a

android.allow_backup = True

[buildozer]
log_level = 2
warn_on_root = 1
bin_dir = ./android

Logs

2024-08-24 15:04:17.259  3043-3077  python                  org.test.test                        I  Initializing Python for Android
2024-08-24 15:04:17.259  3043-3077  python                  org.test.test                        I  Py_LIMITED_API is not defined
2024-08-24 15:04:17.259  3043-3077  python                  org.test.test                        I  PY_VERSION_HEX is defined
2024-08-24 15:04:17.259  3043-3077  python                  org.test.test                        I  PyCell_Get is not defined

Activity

  1. GvozdevLeonid commented on Aug 25, 2024

    @GvozdevLeonid
    ContributorAuthor

    Sorry, I added debug code before python initialization. Now all the necessary functions are available in the code, but for some reason they are still not accessible from the outside. I tried to use pyarmor and get the error

    Traceback (most recent call last):
    File "/Users/leonidgvozdev/Work/example/.buildozer/android/app/main.py", line 31, in <module>
    File "/Users/leonidgvozdev/Work/example/.buildozer/android/app/test.py", line 2, in <module>
    File "/Users/leonidgvozdev/Work/ex ample/.buildozer/android/app/pyarmor_runtime_005896/__init__.py", line 55, in <module>
    File "/Users/leonidgvozdev/Work/example/.buildozer/android/app/pyarmor_runtime_005896/__init__.py", line 52, in __pyarmor__
    RuntimeError: failed to get api PyCell_Get
    

    It seems worth closing this issue.

  2. AL-MKHTAR commented on Feb 26, 2025

    @AL-MKHTAR

    Versions

    • Python:3.11.5
    • OS:Android
    • Kivy:2.3.0
    • Cython:0.29.36
    • OpenJDK: do not know

    Description

    The current version of the interpreter does not support the full list of python api. I checked that the Py_LIMITED_API flag is not set, but some functions are not available for some reason

    start.c

    ...
    LOGP("Initializing Python for Android");
    #ifdef Py_LIMITED_API
        LOGP("Py_LIMITED_API is defined");
        LOGP(Py_LIMITED_API);
    #else
        LOGP("Py_LIMITED_API is not defined");
    #endif
    
    #ifdef PY_VERSION_HEX
        LOGP("PY_VERSION_HEX is defined");
        LOGP(PY_VERSION_HEX);
    #else
        LOGP("PY_VERSION_HEX is not defined");
    #endif
    
    #ifdef PyCell_Get
        LOGP("PyCell_Get is defined");
    #else
        LOGP("PyCell_Get is not defined");
    #endif
    ...

    buildozer.spec

    Command:

    buildozer android debug

    Spec file:

    [app]
    
    title = Test
    
    package.name = Test
    
    package.domain = org.test
    
    source.dir = .
    
    source.include_exts = py,png,jpg,kv,atlas,so
    
    source.exclude_dirs = tests, bin, venv
    
    version = 1
    
    requirements = python3,hostpython3,kivy,libffi
    
    orientation = portrait, landscape, portrait-reverse, landscape-reverse
    
    fullscreen = 1
    android.api = 31
    android.ndk = 25b
    
    android.permissions = INTERNET,MANAGE_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE,READ_EXTERNAL_STORAGE,ACCESS_FINE_LOCATION,ACCESS_COARSE_LOCATION
    
    android.release_artifact = apk
    
    android.manifest.orientation = fullSensor
    
    android.archs = armeabi-v7a, arm64-v8a
    
    android.allow_backup = True
    
    [buildozer]
    log_level = 2
    warn_on_root = 1
    bin_dir = ./android

    Logs

    2024-08-24 15:04:17.259  3043-3077  python                  org.test.test                        I  Initializing Python for Android
    2024-08-24 15:04:17.259  3043-3077  python                  org.test.test                        I  Py_LIMITED_API is not defined
    2024-08-24 15:04:17.259  3043-3077  python                  org.test.test                        I  PY_VERSION_HEX is defined
    2024-08-24 15:04:17.259  3043-3077  python                  org.test.test                        I  PyCell_Get is not defined
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions