KivyMd crashing on android - kivy

My workflow:
In google colab:
!pip install buildozer
!pip install cython==0.29.19
!sudo apt-get install -y \
python3-pip \
build-essential \
git \
python3 \
python3-dev \
ffmpeg \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
libportmidi-dev \
libswscale-dev \
libavformat-dev \
libavcodec-dev \
zlib1g-dev
!sudo apt-get install -y \
libgstreamer1.0 \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good
!sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev zlib1g-dev libssl-dev openssl libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev libncursesw5-dev libffi-dev uuid-dev libffi6
!sudo apt-get install libffi-dev
!buildozer init
Edit the buildozer.spec file and change the lines:
requirements=python3,kivy==2.0.0,pillow,kivymd,requests,schedule,urllib3,charset_normalizer,idna
android.api = 32
Run:
!buildozer -v android debug
Deploy and run.
Result:
I/python: Traceback (most recent call last):
I/python: File "/content/.buildozer/android/app/main.py", line 4, in <module>
I/python: File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/kivymd/__init__.py", line 63, in <module>
I/python: File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/kivymd/font_definitions.py", line 10, in <module>
I/python: File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/kivy/core/text/__init__.py", line 85, in <module>
I/python: File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/kivy/graphics/__init__.py", line 89, in <module>
I/python: ModuleNotFoundError: No module named 'kivy.graphics.instructions'
How can I resolve this?
Thank you

SOLVED!
sudo apt update
sudo apt install -y git zip unzip openjdk-17-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses5-dev libncursesw5-dev libtinfo5 cmake libffi-dev libssl-dev
pip3 install --upgrade Cython==0.29.19
pip3 install --upgrade buildozer
buildozer init
Edit the buildozer.spec file and change the lines:
requirements = python3,kivy==2.1.0,kivymd==1.0.2,sdl2_ttf==2.0.15,pillow, # more packages ...
android.api = 33
Finally:
buildozer -v android debug

Related

Issue compiling Dockerfile on MacOS(apple Sillicon)

This is my first time to use Docker
I build a Dockerfile and use the Vscode remote container to open folder in Container.
When I run this Dockerfile on Windows 11. It does not have any problem
But When I run it on MacOS(apple Sillicon). It have error.
after I step by step to check the Dockerfile.
I find that if I install g++multilib or libc6-dev-i386, it will get error.
I do not have any idea about why?
Dockerfile:
FROM ubuntu:18.04
RUN apt update \
&& apt-get -y install gcc g++ python \
&& apt-get -y install python-dev \
&& apt-get -y install qt4-dev-tools libqt4-dev \
&& apt-get -y install mercurial \
&& apt-get -y install bzr \
&& apt-get -y install cmake libc6-dev \
&& apt-get -y install gdb valgrind \
&& apt-get -y install flex bison libfl-dev \
&& apt-get -y install tcpdump \
&& apt-get -y install sqlite sqlite3 libsqlite3-dev \
&& apt-get -y install gsl-bin libgslcblas0 \
&& apt-get -y install libxml2 libxml2-dev \
&& apt-get -y install libgtk2.0-0 libgtk2.0-dev \
&& apt-get -y install vtun lxc \
&& apt -y install git \
&& apt -y install npm \
&& apt-get -y install g++-multilib libc6-dev-i386
devcontainer.json:
{
"name": "802.11ah ns-3 simulation",
"dockerFile": "Dockerfile",
"appPort": 3000,
"extensions": ["dbaeumer.vscode-eslint"],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
}
}
error information: https://i.stack.imgur.com/ZE04I.jpg
You dont have specified the architetture of Ubuntu container in docker file. Apple silicon have ARM architecture, not all image are compatibile.

Docker openCV installation Issues

I'm currently trying to run an application using Docker but get the following error message when I start the application:
error while loading shared libraries: libopencv_highgui.so.4.4: cannot open shared object file: No such file or directory
I assume that something is going wrong in the docker file and that the installation is not complete or correct. Therefore I have added the section about OpenCV at the end of the post.
Did I miss an important step or an error in the dockerfile?
FROM nvidia/cuda:10.2-devel-ubuntu18.04 as TOOLKITS
RUN apt-get update && apt-get install -y apt-utils
# Install additional packages
RUN apt-get install -y \
build-essential \
bzip2 \
checkinstall \
cmake \
curl \
gcc \
gfortran \
git \
pkg-config \
python3-pip \
python3-dev \
python3-numpy \
nano \
openexr \
unzip \
wget \
yasm
FROM TOOLKITS as GIT_PULLS
WORKDIR /
RUN git clone https://github.com/opencv/opencv.git
RUN git clone https://github.com/opencv/opencv_contrib.git
FROM GIT_PULLS as OPENCV_PREPERATION
RUN apt-get install -y \
libgtk-3-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libv4l-dev \
libxvidcore-dev \
libx264-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libatlas-base-dev \
libtbb2 \
libtbb-dev \
libdc1394-22-dev
FROM OPENCV_PREPERATION as OPENCV_CMAKE
WORKDIR /
RUN mkdir /opencv/build
WORKDIR /opencv/build
RUN cmake \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DWITH_TBB=ON \
-DWITH_V4L=ON \
-DOPENCV_GENERATE_PKGCONFIG=ON \
-DWITH_OPENGL=ON \
-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-DOPENCV_PC_FILE_NAME=opencv.pc \
-DBUILD_EXAMPLES=ON ..
FROM OPENCV_CMAKE as BUILD_OPENCV_MAKE
RUN make -j $(nproc)
RUN make install
FROM TOOLKITS
COPY --from=XXX /opencv /opencv
COPY --from=XXX /opencv_contrib /opencv_contrib
I was facing the same issue before when installing OpenCV in Docker with Python image. You probably don't need this much dependencies but it's an option. I will have a lightweight version that fits my case. Please give a try for the following code:
Heavy-loaded version:
FROM python:3.7
RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
git \
wget \
unzip \
yasm \
pkg-config \
libswscale-dev \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libavformat-dev \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
RUN pip install numpy
WORKDIR /
ENV OPENCV_VERSION="4.1.1"
# install opencv-python from its source
RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip \
&& unzip ${OPENCV_VERSION}.zip \
&& mkdir /opencv-${OPENCV_VERSION}/cmake_binary \
&& cd /opencv-${OPENCV_VERSION}/cmake_binary \
&& cmake -DBUILD_TIFF=ON \
-DBUILD_opencv_java=OFF \
-DWITH_CUDA=OFF \
-DWITH_OPENGL=ON \
-DWITH_OPENCL=ON \
-DWITH_IPP=ON \
-DWITH_TBB=ON \
-DWITH_EIGEN=ON \
-DWITH_V4L=ON \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=$(python3.7 -c "import sys; print(sys.prefix)") \
-DPYTHON_EXECUTABLE=$(which python3.7) \
-DPYTHON_INCLUDE_DIR=$(python3.7 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-DPYTHON_PACKAGES_PATH=$(python3.7 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
.. \
&& make install \
&& rm /${OPENCV_VERSION}.zip \
&& rm -r /opencv-${OPENCV_VERSION}
RUN ln -s \
/usr/local/python/cv2/python-3.7/cv2.cpython-37m-x86_64-linux-gnu.so \
/usr/local/lib/python3.7/site-packages/cv2.so
RUN apt-get --fix-missing update && apt-get --fix-broken install && apt-get install -y poppler-utils && apt-get install -y tesseract-ocr && \
apt-get install -y libtesseract-dev && apt-get install -y libleptonica-dev && ldconfig && apt install -y libsm6 libxext6 && apt install -y python-opencv
Lightweight version:
FROM python:3.7
RUN apt-get update -y
RUN apt-update && apt install -y libsm6 libxext6
For my case, I ended up using the heavy-loaded version just to save some hassle and both versions should work fine. For your reference, please also see this link and thanks to Neo Anderson's great help.
I also had lots of issues in this process, and found this repository:
https://github.com/janza/docker-python3-opencv
Clone or download this and add the additional dependencies and files according to your requirement.
apt-get update -y
apt install -y libsm6 libxext6
apt update
pip install pyglview
apt install -y libgl1-mesa-glx

Unable to install dlib from Dockerfile on Raspberry Pi

I'm trying to install dlib in Dockerfile on a Raspberry Pi 4.
Outside of Docker, I am able to install dlib on the Pi by running
pip3 install --upgrade dlib
But when I try to do it in a Dockerfile as follows:
FROM resin/raspberry-pi-python:3
COPY raspi.list /etc/apt/sources.list.d/raspi.list
COPY sources.list /etc/apt/sources.list
COPY pip.conf /root/.pip/pip.conf
RUN apt-get -y update
RUN apt-get install -y --fix-missing \
build-essential \
cmake \
libopenblas-dev \
liblapack-dev \
libatlas-base-dev \
libx11-dev \
libgtk-3-dev \
gfortran \
git \
wget \
curl \
graphicsmagick \
libgraphicsmagick1-dev \
libatlas-dev \
libavcodec-dev \
libavformat-dev \
libboost-all-dev \
libgtk2.0-dev \
libjpeg-dev \
liblapack-dev \
libswscale-dev \
pkg-config \
python3-dev \
zip \
&& apt-get clean && rm -rf /tmp/* /var/tmp/*
RUN python3 -m ensurepip --upgrade
RUN pip3 install --upgrade dlib
I get errors when I try to build the docker image:
Step 9/12 : RUN pip3 install --upgrade dlib ---> Running in
bf5fa67b254d Looking in indexes:
http://mirrors.aliyun.com/pypi/simple/ Collecting dlib Downloading
http://mirrors.aliyun.com/pypi/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
(3.4MB) Installing collected packages: dlib Running setup.py install
for dlib: started
Running setup.py install for dlib: finished with status 'error'
Complete output from command /usr/local/bin/python3.6 -u -c "import setuptools,
tokenize;file='/tmp/pip-install-sak074zk/dlib/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" install
--record /tmp/pip-record-7yn41l3u/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
package init file 'dlib/init.py' not found (or not a regular file)
running build_ext
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-sak074zk/dlib/setup.py", line 261, in
'Topic :: Software Development',
File "/usr/local/lib/python3.6/site-packages/setuptools/init.py", line
129, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/site-packages/setuptools/command/install.py",
line 61, in run
return orig.install.run(self)
File "/usr/local/lib/python3.6/distutils/command/install.py", line 545, in run
self.run_command('build')
File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-sak074zk/dlib/setup.py", line 129, in run
cmake_version = self.get_cmake_version()
File "/tmp/pip-install-sak074zk/dlib/setup.py", line 120, in get_cmake_version
out = subprocess.check_output(['cmake', '--version'])
File "/usr/local/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/usr/local/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['cmake', '--version']' died with .
Command "/usr/local/bin/python3.6 -u -c "import setuptools,
tokenize;file='/tmp/pip-install-sak074zk/dlib/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" install
--record /tmp/pip-record-7yn41l3u/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-sak074zk/dlib/ You are using pip version 10.0.1,
however version 19.2.3 is available. You should consider upgrading via
the 'pip install --upgrade pip' command. The command '/bin/sh -c pip3
install --upgrade dlib' returned a non-zero code: 1
What am I missing?
I was able to get it to work by changing the base image to
FROM raspbian/stretch
# get base image
FROM raspbian/stretch
RUN apt-get -y update
RUN apt-get install -y --fix-missing \
build-essential \
cmake \
libopenblas-dev \
libblas-dev \
liblapack-dev \
libatlas-base-dev \
libx11-dev \
libgtk-3-dev \
gfortran \
git \
wget \
curl \
graphicsmagick \
libgraphicsmagick1-dev \
libavcodec-dev \
libavformat-dev \
libboost-all-dev \
libgtk2.0-dev \
libjpeg-dev \
liblapack-dev \
libswscale-dev \
pkg-config \
python3-dev \
python3-numpy \
python3-pip \
software-properties-common \
zip \
&& apt-get clean && rm -rf /tmp/* /var/tmp/*
RUN pip3 install setuptools --upgrade
RUN pip3 install cython --upgrade
#Install dlib
RUN cd ~ && \
mkdir -p dlib && \
git clone -b 'v19.9' --single-branch https://github.com/davisking/dlib.git dlib/ && \
cd dlib/ && \
python3 setup.py install --yes

I need some guidance with Docker returning a non-zero code 100

I'm trying to run a Docker build that's worked before, only now I'm on Ubuntu instead of Mac OSX.
I've tried changing the code, adding -y after apt-get update, commenting out part of code, but still get the same result.
This is my Docker file:
FROM nodesource/trusty:5.6.0
RUN locale-gen en_US.UTF-8 && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y software-properties-common
RUN LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php && \
apt-get update && \
apt-get install -y gcc \
nginx \
php5.6 \
php5.6-common \
php5.6-cli \
php5.6-cgi \
php5.6-fpm \
php5.6-apcu \
php5.6-dev \
php5.6-mysqlnd \
php5.6-gd \
php5.6-gmp \
php5.6-imap \
php5.6-curl \
curl \
libsqlite3-dev \
ruby1.9.1-dev \
sqlite3 \
unzip \
php-pear \
php5.6-xsl \
php5.6-sqlite \
openssh-client \
php5.6-mcrypt \
php5.6-mbstring
RUN ln -sfn /usr/bin/php5.6 /usr/bin/php
RUN /usr/bin/curl -sS https://getcomposer.org/installer | /usr/bin/php -- --install-dir=/usr/bin --filename=composer --version=1.0.0
RUN npm install -g gulp bower
This is the error:
Removing intermediate container 07a0c4bb3da2
The command '/bin/sh -c LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php && apt-get update -y && apt-get install -y gcc nginx php5.6 php5.6-common php5.6-cli php5.6-cgi php5.6-fpm php5.6-apcu php5.6-dev php5.6-mysqlnd php5.6-gd php5.6-gmp php5.6-imap php5.6-curl curl libsqlite3-dev ruby1.9.1-dev sqlite3 unzip php-pear php5.6-xsl php5.6-sqlite openssh-client php5.6-mcrypt php5.6-mbstring' returned a non-zero code: 100```
It appears that the PPA ppa:ondrej/php no longer supports Ubuntu Trusty and no longer contains any packages for it (which makes sense, as Trusty became end-of-life in April 2019). You need to update your Docker image to be based on a more recent Ubuntu version, such as Bionic, currently the most recent LTS version.

Kivy cannot be installed on Ubuntu 18.04 with Python 3.7.2

I have followed the instructions on official website of kivy.org to install kivy on my system. But when I type
from kivy.app import App
its showing "no module named 'kivy' ".
I am using ubuntu 18.04 with Python 3.7.2 installed.
Added ppa:
$ sudo add-apt-repository ppa:kivy-team/kivy
Updated package list using your package manager:
$ sudo apt-get update
Install Kivy:
$ sudo apt-get install python3-kivy
Dependencies with legacy PyGame:
sudo apt-get install -y \
python-pip \
build-essential \
mercurial \
git \
python3 \
python3-dev \
ffmpeg \
libsdl-image1.2-dev \
libsdl-mixer1.2-dev \
libsdl-ttf2.0-dev \
libsmpeg-dev \
libsdl1.2-dev \
libportmidi-dev \
libswscale-dev \
libavformat-dev \
libavcodec-dev \
zlib1g-dev
Are there anything else that I need to do? Please help.

Resources