I'm a beginner into python language. I want to develop an android app. I've wrote some code and few days ago I wanted to see how my app looks on mobile before continue.
I've tried all methods to convert .py to .apk but failed. I've tried with google colab, I've installed a VM... but nothing worked. If I use google colab, after all I receive an .apk, but when I install it on my phone, doesn't work... The app opens, but closes imediatly.
If I use VM I receive this error: error message
This is a picture of all my components: components
For google colab I'm using this commands :
!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
!buildozer -v android debug
!buildozer android clean
This is a picture with my google colab: google colab & buildozer.spec
I've tried all tutorials I've found on internet but nothing worked.
The code works perfectly on PC!
Please, help me!
You could try pydroid 3... This isn't really a solution but for now, if you are trying to see how your app looks on an Android device. Get Pydroid 3 from play store. Create a new file and copy your code across into the app and run it... It will run kivy but not kivymd....
If your getting the apk from colab it might be a problem in the code, trying it on pyroid my highlight something and if so when that's altered the new APK might work
Can you connect phone to your system and run this command
adb logcat -s python and then open the app in mobile. This will give you a log why your app crashed. I suspect some issue with the requirements in buildozer.
Could you run the command and share the log?
I think you should see this solution
You can use this video to test that solution (It's in Spanish but I hope you can translate it)
I tried and it works
The key is to edit buildozer.spec
After that you can test your own solution
Related
links i have tried to use to download a environment and dependencies for doom(chocolate) on a raspberry pi b+ does not work, and i am unsure about installing some of the programs manually. do you know any other places to get these dependencies on Rasbian?
Wanting to download chocolate doom i first tried to download the dependencies and came back with a 404 page not found error. After downloading and unzipping the doom engine (ready to install dependencies than wad files and then to run) i came back and tried again.I first looked though a guide in a magazine i had (the APC mag issue 441) i looked on the doom wiki and used a similar link which also failed.i visited the page on google chrome and got a 404 error as well.
i used this
sudo apt-get install libsdl-mixer1.2-dev libsdl-net1.2-dev python
-imaging
in the terminal and got a 404 error not found and then used the link from doom wiki
sudo apt-get install gcc make libsdl2-dev libsdl2-net-dev \
libsdl2-mixer-dev python-imaging
and got a similar error.
i did not expect to get a page not found error as i watched a friend use the same link 1 day earlier. Instead the expected outcome was s dependencies installed message at least.
First update the local package index with:
sudo apt update
The dependencies:
sudo apt-get install gcc make libsdl2-dev libsdl2-net-dev libsdl2-mixer-dev
sudo apt-get install python-pil:i386 python-pil
If a simple sudo apt-get install chocolate-doom doesn't work then proceed to try a manual build.
Quoting from this wiki follow the directions below for a manual build.
Install the Chocolate Doom Source Code:
https://www.chocolate-doom.org/downloads/3.0.0/chocolate-doom-3.0.0.tar.gz
Now the Building:
Unzp Tarball: tar xzf PATH/TO/chocolate-doom-3.0.0.tar.gz
Then mount the package: cd chocolate-doom-3.0.0
Run: ./configure
Run: make
Run: make install
Done.
I am following this tutorial using Google Colab.
When I run the line game.init(), I get this error:
ViZDoomErrorException: Could not initialize SDL video:
No available video device
I installed vizdoom as follows:
%%bash
# Install deps from
# https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#-linux
apt-get install build-essential zlib1g-dev libsdl2-dev libjpeg-dev \
nasm tar libbz2-dev libgtk2.0-dev cmake git libfluidsynth-dev libgme-dev \
libopenal-dev timidity libwildmidi-dev unzip
# Boost libraries
apt-get install libboost-all-dev
# Lua binding dependencies
apt-get install liblua5.1-dev
Colab is run on a machine in the cloud. It cannot send the display back to your local machine. That's why it said "no video device".
Add the line game.set_window_visible(False) in the Step 8 cell of the Jupyter Notebook. Unless explicitly mentioned, ViZDoom tries to launch the application, which is not supported in Colab.
I'm currently working on the "Google cloud platform fundamentals" labs and I'm running into issues.
Each time I have to use a CoreOS instance to spin up a docker instance there is an error I get.
For example: in the Cloud SQL lab, at some point I have to build a docker image of the folder I just cloned from a git repo using the command:
docker build -t cp100/cloudsql-python cp100-cloud-sql-python
which gives me a wall of text that ends with an error :
Downloading/unpacking flask
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement flask
No distributions at all found for flask
Storing complete log in /root/.pip/pip.log`
The thing Is, there is no "/root/.pip/pip.log" file.
So here are my questions :
Are the tutorials outdated, and if yes, where can I find the up-to-date tutorials?
Why does it happen? I think It is because pip or Python or both are not installed but shouldn't the command docker build take the installation in charge?
How can I fix it?
the cp100-cloud-sql-python file is available at https://github.com/GoogleCloudPlatformTraining/cp100-cloud-sql-python.git
Thanks for your answers.
Ok I found the answers by myself:
So the reason it doesn't work is that pip (and easy install) use HTTP and pypi.python.org requires HTTPS, the issue is further documented here :
https://bugzilla.redhat.com/show_bug.cgi?id=1510444
So in order to fix it I modified the Dockerfile inside the app from
FROM google/debian:wheezy
MAINTAINER Sharif Salah <sharif.salah+docker#gmail.com>
RUN apt-get update && \
apt-get install -y python-dev python-pip python-mysqldb && \
pip install flask
ADD app /app
EXPOSE 80
CMD [ "python", "/app/app.py" ]
to
FROM google/debian:wheezy
MAINTAINER Sharif Salah <sharif.salah+docker#gmail.com>
RUN apt-get update && \
apt-get install -y python-dev python-setuptools python-mysqldb && \
easy_install -i https://pypi.python.org/simple flask
ADD app /app
EXPOSE 80
CMD [ "python", "/app/app.py" ]
which will force easy_install to use the address specified after the -i.
It worked in my case but as documented on Bugzilla, it may not work for everything.
I hope this will help someone
I just installed PyQt 5.7.0 on my google compute engine machine which running on a ubuntu 16.04:
However, when I wanted to run PyQt and import some module, it produce Segmentation fault (core dumped) error as shown:
Can I know how do I solve it? I have been searching an answer for this for hours and still can't find an answer. Will be greatly appreciated if anyone could help.
You can try (as explained in the comments) to compile PyQt5.7 yourself, using a different version of Python (3.4.3 and 3.4.4 worked for me, everything above 3.5 did not). Note that I also compiled Qt5.7 myself, but you can use the one provided by the installer. Here is a short, hopefully exhaustive, set of commands to setup a virtual environment:
Install dependencies using apt:
sudo apt-get install -y build-essential libgl1-mesa-dev libx11-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libfontconfig1-dev libfreetype6-dev libglu1-mesa-dev libssl-dev libcups2-dev python3-pip git
Install Python 3.4.4:
cd ~/Downloads
wget https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tar.xz
tar xf Python-3.4.4.tar.xz
cd Python-3.4.4
./configure
sudo make altinstall
Create the virtual environment:
sudo pip3 install virtualenv
virtualenv -p /usr/local/bin/python3.4 ~/python34
source ~/python34/bin/activate
Install Qt:
cd ~/Downloads
git clone git://code.qt.io/qt/qt5.git
cd ~/Downloads/qt5
git checkout 5.7
./init-repository
./configure -prefix ~/Qt/5.7/gcc_64 -opensource -nomake examples -nomake tests -release -confirm-license
make -j 5
make install
Install SIP:
cd ~/Downloads
wget http://downloads.sourceforge.net/project/pyqt/sip/sip-4.18.1/sip-4.18.1.tar.gz
tar xf sip-4.18.1.tar.gz
cd sip-4.18.1
python configure.py
make
sudo make install
Install PyQt:
cd ~/Downloads
wget http://downloads.sourceforge.net/project/pyqt/PyQt5/PyQt-5.7/PyQt5_gpl-5.7.tar.gz
tar xf PyQt5_gpl-5.7.tar.gz
cd PyQt5_gpl-5.7
python configure.py --qmake ~/Qt/5.7/gcc_64/bin/qmake --disable QtPositioning --no-qsci-api --no-designer-plugin --no-qml-plugin --confirm-license
make -j 5
sudo make install
Caveats:
I'm going to assume that you can't run any GUI programs right now in your vm.
I'm not that familiar with GCE platform and have not tried what I'm going to propose
Follow the steps at Your desktop on Google Cloud Platform to install a desktop GUI manager in the GCE vm (it will be X11-based for Linux OS), as well as vnc server.
Once you are vnc'd in to your vm using realvnc or tightvnc viewer, a GUI app will likely run. You may have to change the X11 DISPLAY variable -- eventhough the above link does not discuss this -- because AFAIR *nix systems use a separate desktop session for VNC than the one currently logged in.
I doubt it will run if there is no user logged on to the GCE vm.
If you installed PyQt5 with apt or apt-get, now do also
sudo pip3 install pyqt5
You cannot run a GUI program (PyQt) remotely, unless both machines use X11 protocol with properly set DISPLAY variables and xhost permissions. I doubt that Google compute engine is configurable to run in the X11 mode.
When you import PyQt5, it will also import PyQt5.QtCore because PyQt5.QtCore is part of PyQt5.
I'm trying to move my app from Google App Engine to Compute Engine with managed VMs. According to documentation, I would only need to add vm: true
and different instances specification to my app.yaml to get things working.
Unfortunately, I get ImportError: libxslt.so.1: cannot open shared object file: No such file or directory when trying to import lxml. I've got a list of needed libraries in app.yaml, and it works when I deploy my app to App Engine.
On the next step, I tried to create my own docker file, which will install all the needed libraries. Now it looks like this:
FROM beta.gcr.io/google_appengine/python-compat
RUN apt-get -q update && \
apt-get install --no-install-recommends -y -q \
python2.7 python-pip python-dev build-essential git mercurial \
libffi-dev libssl-dev libxml2-dev \
libxslt1-dev libpq-dev libmysqlclient-dev libcurl4-openssl-dev \
libjpeg-dev zlib1g-dev libpng12-dev && \
apt-get clean && rm /var/lib/apt/lists/*_*
RUN pip install lxml==2.3.5
ADD . /app
And now I'm getting new error ImportError: /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.14' not found (required by /home/vmagent/app/lib/lxml/etree.so). Adding libc6 to packages list for apt-get doesn't change anything, so I'm out of the ideas.
So how can I get my app working here?
You must install this package, this package is responsible for libc.so.6
yum install libtidy glibc