Is it possible to use any Python package within a Kivy program, and ultimately running it on an android device? for example - can I use the package "xlrd" or "googlemaps" on Kivy? If the answer is positive, How do I do it? normally I get an error message that says "No module named X".
Thank you.
Yes you can. Just download the package you want to use and place it in the same folder as your main.py. Then import whatever you wish to use from that package. The packages will also work when you deploy the app onto an Android device.
Related
I need a solution for this (I haven't tried it in mobile yet cause the program is in the development stage but I know the question will also get a late response) that if I have multiple modules installed via command prompt and if I use those modules to make an android app then will the app function as it did in the PC or will it say that the modules are missing and keep on crashing, I'm new to app development please help me.
An important thing to know is that PyAudio provides Python bindings for PortAudio, a cross-platform audio I/O library.
It unifies APIs from every OS like ASIO for professional Audio WASAPI for Windows, Core Audio for Mac and ALSA for Linux, etc. so you want to know if PortAudio support Android.
Have a look here:
https://source.android.com/devices/audio
Android is using ALSA, which PortAudio supports, so Pyaudio should support it as well. I guess the only way to make sure is to try it out. :)
If you include the module in the compilation process (I don't know what you're using for compiling/developing so not sure how to help there) the app won't crash. In the worst case it will just not play the audio, but the rest of the app should work (unless some part of it requires the audio to be played).
Recently I've been working on a project that involves a phone taking a picture, processing it in some way, and returning the output on the screen. In order to do this, I would have to use openCV, but when I try to "import cv2" in the Kivy code using the launcher, the app crashes immediately after I run it. I realize now that the reason this happens is because the Kivy launcher by itself can only do basic functions like print and such and there must be extra steps needed to use external libraries. I tried to use Buildozer to create a package for android, but soon found out that it only would work for linux computers, while I use Windows.
Essentially, my question is: Is there any way to include an external library in Kivy without using buildozer? And if there is, could you please describe it or post a link to a webpage that contains instructions(as I am fairly new to programming and am somewhat of a noob)
Thanks!
You can try python-for-android.
But the easiest way - install virtual box to your PC, download kivy/buildozer for VirtualBox( it calles Virtual Machine (for Android/buildozer)) here below: https://kivy.org/#download and then just connect downloaded vmdk-disk to VirtualBox, and then use this. Everything is prepared, you don't need to install kivy or buildozer.
You will spend about 30-40 minutes.
I recently started learning to use Python and built in modules such as Tkinter. However in order to finish the programme I am making, I need to use pygame to open a music file in the programme. I have what I am sure is the correct pygame files (see image) but I have no clue how to actually add it to be able to use when coding in Python. (Get the error that the module cannot be found).
If there is an intergrated Python module that will allow me to open music files then I would be interested in knowing if that is an easier method.
Pygame files:
In a web browser go to http://www.pygame.org/download.shtml locate the package that matches your environment and follow the instructions, (either download and run or type the command).
I'm trying to install kivy to make an application for android and ios.
I have installed the portable app as per the website but wanted to have it included in my python Idle.
So I searched and found Kivy-1.8.0.win32-py3.4.exe installs it ontop of your python instalation (C:\python34)
When i try and import i can import kivy but it wont let me install App or recognise UIX.
I have looked around and I think that my issue is with pygame, every time i try to install it i get missing files and that is with pip and a pygame-1.9.2a0.win32-py3.2.msi that i found but still nothing!
Also read it might be cython and i installed that too downloading Cython-0.21.1 andtrying to run the instaltion on that.
Is there a way to get this done without a headache?
Do i need kivy to make an app for android and ios or can i use tkinter? (thats works on my pc lol)
please any advice would be great, I have searched but all the information out there is very disjointed and im hoping to find a one stop answer in one of you guys.
thanks
Raif
Do i need kivy to make an app for android and ios or can i use tkinter? (thats works on my pc lol)
You need kivy (or maybe some other python tools, but I don't think any are remotely as good). The android build tools only work on linux or osx, though you can use a virtual machine for it.
If you installed from the popular unofficial windows binaries site, make sure the version matches your python version, and you probably need to get pygame from the same place. I don't know much about this though.
Linux is the best python development environment. Python on Windows is very very buggy with certain packages due to compatibility issue. Many important development packages in python are optimized for Linux. You get rid of all headache by downloading and installing a lightweight Linux like o. So like back box on a virtual machine.
If your goal is a Kivy app for iOS and Android, you have already made several mistakes. The first is that you cannot create an iOS app from any OS except OSX. There's no way around that. The second is that the tools for compiling for Android and iOS only work with Python2.7 currently. You seem to be using Python 3.4.
I wrote a program which uses a number of built in modules. The program is meant to be used by different persons on their systems. They dont have enough knowledge in python to install it when their system doesnt have the module needed to run the program. Is there any way of handling that.
Also I want to package the program as an executable in linux. It contains 3 py files and one text file only.
I think what you need is to create a debian package that handles the dependencies and the installation process.
I'm an Ubuntu user but this Complete Ubuntu Packaging Guide should help you get started. Good luck!
You can create an executable that contains your python modules and the python interpreter. You can use PyInstaller for creating such an executable.
I think the easiest way to achieve this on a debian distribution is to package your python application in a debian package. You can use this module to make life easier.