No module name PIL

158 views
Skip to first unread message

Thasatsaya Sriwongchai

unread,
Jul 1, 2022, 6:50:52â€ŊAM7/1/22
to Kivy users support
I try to deploy my python app (https://github.com/thasatsaya/myproject) using kivy , kivymd , buildozer & android debug bridge followed by these instructions (https://youtu.be/pzsvN3fuBA0) in which I also use ubuntu on windows. Furthermore after I can deploy his app I have add the requirements in buildozer.spec file which is  " requirements = kivy==2.0.0, kivymd==0.104.1, sdl2_ttf == 2.0.15, pillow " and install kivymd using " pip install kivymd==0.104.1" as followed by the Kivymd Github Page (https://github.com/kivymd/KivyMD) and I also try code from this channel (https://youtu.be/VsTaM057rdc) and it also work fine. but for my code after running command  adb -s DEVICE_ID logcat *:S python:D after install app on my phone by usb it show " No module name PIL" in which most forum said by adding pillow to the requirements it should be fixed but I have already add that and it still show this error.
285276865_1196384044526963_7651516024424987431_n.png  

Robert

unread,
Jul 1, 2022, 12:44:00â€ŊPM7/1/22
to Kivy users support
What version of Buildozer are you using?
Was the p4a version changed from the default ?

Please post the full build log as a .txt  (do a buildozer appclean first so everything is rebuilt)

Thasatsaya Sriwongchai

unread,
Jul 1, 2022, 1:37:23â€ŊPM7/1/22
to Kivy users support
- Buildozer 1.4.0.dev0
- I'm not sure about p4a version but the thing I change related to p4a is p4a.branch = develop & p4a.fork = thasatsaya which is my github ( I got this way of setup fork from  https://youtu.be/VsTaM057rdc)
- I have run using buildozer android debug so from my understanding it didn't run as root (cause no sudo thing) for no.2 I use ubuntu on window but didn't do any disk mount so I think it's completely separated but no3 I have no idea what that mean sorry. 

I have rebuild by using buildozer android clean follow by buildozer android debug and add crash.txt according to your suggest.


āđƒāļ™āļ§āļąāļ™āļ—āļĩāđˆ āļ§āļąāļ™āļĻāļļāļāļĢāđŒāļ—āļĩāđˆ 1 āļāļĢāļāļŽāļēāļ„āļĄ āļ„.āļĻ. 2022 āđ€āļ§āļĨāļē 23 āļ™āļēāļŽāļīāļāļē 44 āļ™āļēāļ—āļĩ 00 āļ§āļīāļ™āļēāļ—āļĩ UTC+7 Robert āđ€āļ‚āļĩāļĒāļ™āļ§āđˆāļē:
crash.txt

Robert

unread,
Jul 1, 2022, 7:55:21â€ŊPM7/1/22
to Kivy users support
Never rely on what some dweeb on Youtube says.
Youtube imparts confidence not competence.
If you want to show you did your due diligence, then reference the documentation.

The first issue is that clever adb trick is wrong. It is missing -r , see adb --help
I don't know if it works otherwise, the simple way to be certain is to copy the .apk and   adb install -r foo.apk

If there is still an issue , try with the release Buildozer (1.3.0) ,  p4a.branch = master (the default) , and no p4a.fork. (the default)
`buildozer appclean`  before the build
If there is still an issue, post the BUILD log

Thasatsaya Sriwongchai

unread,
Jul 2, 2022, 9:38:18â€ŊAM7/2/22
to Kivy users support
As you suggested I edit buildozer.spec file to
- p4a.branch = master instead of develop
- put comment on p4a.fork
- change buildozer to 1.3.0 by using pip install buildozer==1.3.0

then rebuild by using buildozer android clean & buildozer android debug
and install apk file using adb -s DEVICEID install -r APPNAME.apk
I think build log look the same
crash2.txt

Robert

unread,
Jul 2, 2022, 1:13:51â€ŊPM7/2/22
to Kivy users support
You are still using the incorrect adb command

If you still have a problem post the BUILD log

Thasatsaya Sriwongchai

unread,
Jul 4, 2022, 3:56:57â€ŊAM7/4/22
to Kivy users support
so what you mean is instead of  adb -s DEVICEID install -r APPNAME.apk replace with adb install -r APPNAME.apk right?
I've try that and build log is still the same.

āđƒāļ™āļ§āļąāļ™āļ—āļĩāđˆ āļ§āļąāļ™āļ­āļēāļ—āļīāļ•āļĒāđŒāļ—āļĩāđˆ 3 āļāļĢāļāļŽāļēāļ„āļĄ āļ„.āļĻ. 2022 āđ€āļ§āļĨāļē 0 āļ™āļēāļŽāļīāļāļē 13 āļ™āļēāļ—āļĩ 51 āļ§āļīāļ™āļēāļ—āļĩ UTC+7 Robert āđ€āļ‚āļĩāļĒāļ™āļ§āđˆāļē:
crash3.txt

Robert

unread,
Jul 4, 2022, 12:44:26â€ŊPM7/4/22
to Kivy users support
> adb install -r myapp-0.1-arm64-v8a_armeabi-v7a-debug.apk 

That is one issue fixed (assuming it is the right version of the ,apk file)

Re-check that you are using the master version of p4a (this is important)

Post the apk BUILD log not the apk RUN log.
Do a 'buildozer appclean' before doing the build.

Thasatsaya Sriwongchai

unread,
Jul 4, 2022, 11:26:57â€ŊPM7/4/22
to Kivy users support
I've recheck yes it's on p4a master. And now I add you the build log that I've build after doing buildozer appclean. It's exceed max quota of ubuntu lines so it's missing by some lines.

āđƒāļ™āļ§āļąāļ™āļ—āļĩāđˆ āļ§āļąāļ™āļˆāļąāļ™āļ—āļĢāđŒāļ—āļĩāđˆ 4 āļāļĢāļāļŽāļēāļ„āļĄ āļ„.āļĻ. 2022 āđ€āļ§āļĨāļē 23 āļ™āļēāļŽāļīāļāļē 44 āļ™āļēāļ—āļĩ 26 āļ§āļīāļ™āļēāļ—āļĩ UTC+7 Robert āđ€āļ‚āļĩāļĒāļ™āļ§āđˆāļē:
build.txt

Robert

unread,
Jul 5, 2022, 2:17:50â€ŊAM7/5/22
to Kivy users support
Thanks, yes there is a big chunk of the build log missing, but that is OK.
I can see that p4a is not building Pillow.

I saw another user last week, who had followed the same YouTube example as you, and had the same two issues.

In that case after fixing the install issue,  I replicated the issue, and the user confirmed, we fixed the second issue
with p4a.branch=master  this is the default.
(nobody should use the in development version, but it seems that YouTube video misleads)
I demonstrated the fix using the release Buildozer. Perhaps there is an interaction?

So try: uninstall the development version of Buildozer and install the release version

And please double check that the installed apk is really your latest build.

Thasatsaya Sriwongchai

unread,
Jul 5, 2022, 4:46:44â€ŊAM7/5/22
to Kivy users support
I've deleted buildozer 1.4.0.dev0 and install buildozer 1.3.0 (reinstall-buildozer.txt)
and rebuild the file using ' buildozer appclean ' & ' buildozer android debug ' (build2.txt)
finally I use the adb install -r myapp-0.1-arm64-v8a_armeabi-v7a-debug.apk and I'm sure that it's the right one as the name from build log when they said successfully install is also this one. (crash4.txt)
āđƒāļ™āļ§āļąāļ™āļ—āļĩāđˆ āļ§āļąāļ™āļ­āļąāļ‡āļ„āļēāļĢāļ—āļĩāđˆ 5 āļāļĢāļāļŽāļēāļ„āļĄ āļ„.āļĻ. 2022 āđ€āļ§āļĨāļē 13 āļ™āļēāļŽāļīāļāļē 17 āļ™āļēāļ—āļĩ 50 āļ§āļīāļ™āļēāļ—āļĩ UTC+7 Robert āđ€āļ‚āļĩāļĒāļ™āļ§āđˆāļē:
crash4.txt
build2.txt
reinstall-buildozer.txt

Robert

unread,
Jul 5, 2022, 12:57:29â€ŊPM7/5/22
to Kivy users support

Thasatsaya Sriwongchai

unread,
Jul 6, 2022, 1:47:10â€ŊAM7/6/22
to Kivy users support
- yes I do after I change buildozer.spec

Do any of these apply ?
No 1. I've check through ls -la . All files and folders are not under root (myproject.txt)
No 2. I did not use any mount command so I think my ubuntu on windows is separate from my windows system.
No 3. I have no idea how to check this one
āđƒāļ™āļ§āļąāļ™āļ—āļĩāđˆ āļ§āļąāļ™āļ­āļąāļ‡āļ„āļēāļĢāļ—āļĩāđˆ 5 āļāļĢāļāļŽāļēāļ„āļĄ āļ„.āļĻ. 2022 āđ€āļ§āļĨāļē 23 āļ™āļēāļŽāļīāļāļē 57 āļ™āļēāļ—āļĩ 29 āļ§āļīāļ™āļēāļ—āļĩ UTC+7 Robert āđ€āļ‚āļĩāļĒāļ™āļ§āđˆāļē:
myproject.txt

Robert

unread,
Jul 6, 2022, 3:01:32â€ŊAM7/6/22
to Kivy users support
'run as root' means logged in as root   (the admin account) , or using sudo.

In the context of a Linux file system, by definition, everything is under root, but that is something different from the root account.
What you checked was 'owned by root', which not 'run as root'.

I suggest some basic Linux tutorial - but not one on YouTube!

Thasatsaya Sriwongchai

unread,
Jul 6, 2022, 4:37:53â€ŊAM7/6/22
to Kivy users support
I've once use sudo while build the app but I've change it from root to 'che' which is ubuntu name already (sudo chown -R che:che). Do you have some other suggestion? 
āđƒāļ™āļ§āļąāļ™āļ—āļĩāđˆ āļ§āļąāļ™āļžāļļāļ˜āļ—āļĩāđˆ 6 āļāļĢāļāļŽāļēāļ„āļĄ āļ„.āļĻ. 2022 āđ€āļ§āļĨāļē 14 āļ™āļēāļŽāļīāļāļē 01 āļ™āļēāļ—āļĩ 32 āļ§āļīāļ™āļēāļ—āļĩ UTC+7 Robert āđ€āļ‚āļĩāļĒāļ™āļ§āđˆāļē:

Robert

unread,
Jul 6, 2022, 1:18:58â€ŊPM7/6/22
to Kivy users support
I suspect some state somewhere is incorrect, because of that 'sudo buildozer ...`

Changing the ownership of the project files is a good first step.
But for the build databases the state may be wrong, delete and let them self rebuild.
 
Delete both <project>/.buildozer and ~/.buildozer   , use sudo for this.

If you still have an issue delete ~/.gradle (if it exists) and the next one would be ~/.cache , again use sudo.

Message has been deleted

Thasatsaya Sriwongchai

unread,
Jul 7, 2022, 4:46:46â€ŊAM7/7/22
to Kivy users support
I've try to delete with 'sudo rm -rf /.buildozer' and 'sudo rm -rf  ~/.buildozer' and rebuild with buildozer android debug. The result is failed so I sent you the build log.

āđƒāļ™āļ§āļąāļ™āļ—āļĩāđˆ āļ§āļąāļ™āļžāļĪāļŦāļąāļŠāļšāļ”āļĩāļ—āļĩāđˆ 7 āļāļĢāļāļŽāļēāļ„āļĄ āļ„.āļĻ. 2022 āđ€āļ§āļĨāļē 0 āļ™āļēāļŽāļīāļāļē 18 āļ™āļēāļ—āļĩ 58 āļ§āļīāļ™āļēāļ—āļĩ UTC+7 Robert āđ€āļ‚āļĩāļĒāļ™āļ§āđˆāļē:
build3.txt

Robert

unread,
Jul 7, 2022, 12:38:09â€ŊPM7/7/22
to Kivy users support
> [ERROR]: Build failed: Requested API target 27 is not available, install it with the SDK android tool.

Thasatsaya Sriwongchai

unread,
Jul 7, 2022, 2:45:20â€ŊPM7/7/22
to Kivy users support
I've try uncomment lines in buildozer.spec and change it to  android.api = 33 as you suggested. The build is successful. But run log is the same. Should I change anything else on buildozer.spec?

āđƒāļ™āļ§āļąāļ™āļ—āļĩāđˆ āļ§āļąāļ™āļžāļĪāļŦāļąāļŠāļšāļ”āļĩāļ—āļĩāđˆ 7 āļāļĢāļāļŽāļēāļ„āļĄ āļ„.āļĻ. 2022 āđ€āļ§āļĨāļē 23 āļ™āļēāļŽāļīāļāļē 38 āļ™āļēāļ—āļĩ 09 āļ§āļīāļ™āļēāļ—āļĩ UTC+7 Robert āđ€āļ‚āļĩāļĒāļ™āļ§āđˆāļē:
crash5.txt
build4.txt

Robert

unread,
Jul 7, 2022, 5:10:05â€ŊPM7/7/22
to Kivy users support
Looking back at the previous post,

In the project directory:
It is not       sudo rm -rf /.buildozer
It is       sudo rm -rf ./.buildozer     (or more simply  sudo rm -rf .buildozer)

At this point I'm starting to run out of ideas.
Reply all
Reply to author
Forward
0 new messages