kivy / python-for-android

Turn your Python application into an Android APK
https://python-for-android.readthedocs.io
MIT License
8.33k stars 1.84k forks source link

Kivy/Buildozer/Psycopg2 #1144

Closed RPANISSET closed 5 years ago

RPANISSET commented 7 years ago

I've developed an application that uses the postgresql database, I use the PSYCOPG2 module to make the connection. Now when I was generating the APP for Android through BUILDOZER it gives an error and they are telling me that PSYCOPG2 does not work with BUILDOZER, is that it? How should I proceed then?

Thank's

Rogério

RPANISSET commented 7 years ago

Following is the log after the buildozer android debug deploy run

Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.18.4 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /usr/local/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
# Install platform
# Run 'pip install -q --user "appdirs" "colorama>=0.3.3" "sh>=1.10,<1.12.5" "jinja2" "six"'
# Cwd None
# Apache ANT found at /home/kivy/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/kivy/.buildozer/android/platform/android-sdk-23
# Android NDK found at /home/kivy/.buildozer/android/platform/android-ndk-r9c
# Check application requirements
# Check garden requirements
# Compile platform
# Using custom source dirs:
    P4A_kivymd_DIR = /home/kivy
# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=cidadeApp --bootstrap=sdl2 --requirements=kivy==master,git+https://gitlab.com/kivymd/KivyMD.git,hostpython2,psycopg2 --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/kivy/Desktop/Cidade/.buildozer/android/platform/build'
# Cwd /home/kivy/Desktop/Cidade/.buildozer/android/platform/python-for-android-master
[0m
           working: Python-2.7.2.tar.bz2                                       [0m
                                                                               
[0m
           working: SDL2_image-2.0.1.tar.gz                                    [0m
                                                                               
[0m
           working: SDL2_mixer-2.0.1.tar.gz                                    [0m
                                                                               
[0m
           working: SDL2_ttf-2.0.14.tar.gz                                     [0m
                                                                               
[0m
           working: Python-2.7.2.tar.bz2                                       [0m
                                                                               
[0m
           working: postgresql-9.5.3.tar.bz2                                   [0m
                                                                               
[0m
           working: SDL2-2.0.4.tar.gz                                          [0m
                                                                               
[0m
           working: six-1.9.0.tar.gz                                           [0m
                                                                               
[0m
           working: psycopg2-latest.tar.gz                                     [0m
                                                                               
[0m
           working: master.zip                                                 [0m
                                                                               
[0m
           working: master.zip                                                 [0m
                                                                               
[0m
           working: Python-2.7.2.tar.bz2                                       [0m
                                                                               
[0m
           working: SDL2_image-2.0.1.tar.gz                                    [0m
                                                                               
[0m
           working: SDL2_mixer-2.0.1.tar.gz                                    [0m
                                                                               
[0m
           working: SDL2_ttf-2.0.14.tar.gz                                     [0m
                                                                               
[0m
           working: Python-2.7.2.tar.bz2                                       [0m
                                                                               
[0m
           working: postgresql-9.5.3.tar.bz2                                   [0m
                                                                               
[0m
           working: SDL2-2.0.4.tar.gz                                          [0m
                                                                               
[0m
           working: six-1.9.0.tar.gz                                           [0m
                                                                               
[0m
           working: psycopg2-latest.tar.gz                                     [0m
                                                                               
[0m
           working: master.zip                                                 [0m
                                                                               
[0m
           working: master.zip                                                 [0m
                                                                               
[0m
           working: Android NDK: WARNING:/home/kivy/Desktop/C...(and 150 more) [0m
           working: Android NDK:     This is likely to result ...(and 53 more) [0m
           working: Android NDK:     or LOCAL_SHARED_LIBRARIES...(and 48 more) [0m
           working: Android NDK:     current module                            [0m
           working: rm -f /home/kivy/Desktop/Cidade/.buildoze...(and 429 more) [0m
           working: rm -f /home/kivy/Desktop/Cidade/.buildoze...(and 437 more) [0m
           working: rm -f /home/kivy/Desktop/Cidade/.buildoze...(and 437 more) [0m
           working: [armeabi-v7a] Install        : libSDL2.so ...(and 30 more) [0m
           working: install -p /home/kivy/Desktop/Cidade/.bui...(and 222 more) [0m
           working: /home/kivy/.buildozer/android/platform/an...(and 246 more) [0m
           working: [armeabi-v7a] Install        : libSDL2_ima...(and 42 more) [0m
           working: install -p /home/kivy/Desktop/Cidade/.bui...(and 234 more) [0m
           working: /home/kivy/.buildozer/android/platform/an...(and 252 more) [0m
           working: [armeabi-v7a] Install        : libSDL2_mix...(and 42 more) [0m
           working: install -p /home/kivy/Desktop/Cidade/.bui...(and 234 more) [0m
           working: /home/kivy/.buildozer/android/platform/an...(and 252 more) [0m
           working: [armeabi-v7a] Install        : libSDL2_ttf...(and 38 more) [0m
           working: install -p /home/kivy/Desktop/Cidade/.bui...(and 230 more) [0m
           working: /home/kivy/.buildozer/android/platform/an...(and 250 more) [0m
           working: [armeabi-v7a] Install        : libmain.so ...(and 30 more) [0m
           working: install -p /home/kivy/Desktop/Cidade/.bui...(and 222 more) [0m
           working: /home/kivy/.buildozer/android/platform/an...(and 246 more) [0m
                                                                               
[0m
           working: running build_ext                                          [0m
           working: Error: pg_config executable not found.                     [0m
           working: Please add the directory containing pg_config to the PATH  [0m
           working: or specify the full executable path with the option:       [0m
           working:     python setup.py build_ext --pg-config ...(and 28 more) [0m
           working: or with the pg_config option in 'setup.cfg'.               [0m
                                                                               
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=cidadeApp --bootstrap=sdl2 --requirements=kivy==master,git+https://gitlab.com/kivymd/KivyMD.git,hostpython2,psycopg2 --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/kivy/Desktop/Cidade/.buildozer/android/platform/build
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
inclement commented 5 years ago

Closing as stale, psycopg needs a recipe to work.

AndreMiras commented 5 years ago

For future records, there's a recipe and it works, see https://github.com/kivy/python-for-android/blob/0.7.0/pythonforandroid/recipes/psycopg2/__init__.py

ghost commented 5 years ago

@AndreMiras how do I add this recipe to my package?

AndreMiras commented 5 years ago

Usually you just need to add it to you requirements list

ghost commented 5 years ago

image Well, I'm compiling with buildozer, and my app is returning this error to me. Seems that the .spec file, where I specified the requirements, and obviously psycopg2, isn't packing the library to my APK

AndreMiras commented 5 years ago

It's not the same issue as this one above. The original issue was about psycopg2 not even compiling. For you it's a runtime issue

Delivery-Klad commented 4 years ago

Usually you just need to add it to you requirements list

how can I do this?

lawchin commented 2 years ago

just paste it inside the buildozer spec look at line 40: