{"id":512,"date":"2024-05-14T02:01:31","date_gmt":"2024-05-14T02:01:31","guid":{"rendered":"https:\/\/techris.in\/?p=512"},"modified":"2024-06-20T22:42:22","modified_gmt":"2024-06-20T22:42:22","slug":"solve-no-module-named-math-during-building-app-in-python-for-android-or-buildozer","status":"publish","type":"post","link":"https:\/\/techris.in\/python\/solve-no-module-named-math-during-building-app-in-python-for-android-or-buildozer.html","title":{"rendered":"Solve No module named math during building app in python for android or buildozer"},"content":{"rendered":"

While building an Python based android app you may encounter the following error<\/p>\n

\n
\u001b[2m< from random import Random as _Random\u001b[0m\r\n\u001b[2m< File \"\/home\/gk\/.local\/share\/python-for-\r\nandroid\/build\/other_builds\/hostpython3\/desktop\/hostpython3\/Lib\/random.py\",\r\nline 49, in <module>\u001b[0m\r\n\u001b[2m< from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as\r\n_ceil\u001b[0m\r\n\u001b[2m< ModuleNotFoundError: No module named 'math'\u001b[0m\u001b[2m\u001b[0m<\/code><\/pre>\n<\/div>\n

This is caused while running the following command<\/p>\n

\n
\n

<\/span><\/p>\n

\n
p4a apk --private $dir --package org.techris.omr --name \"Techris OMR\" --version 24.05.10 --bootstrap sdl2 --requirements python3==3.11.2,kivy,kivymd,sqlite3 --sdk-dir \/home\/gk\/Android\/Sdk --ndk-dir \/home\/gk\/Documents\/android-ndk-r25b-linux\/android-ndk-r25b --android-api 34 --ndk-api 24 --arch armeabi-v7a --arch arm64-v8a --arch x86_64 --permission INTERNET --icon \/home\/gk\/Documents\/logo.png --presplash \/home\/gk\/Documents\/logo.png --presplash-color \"#70AB44\" --debug<\/code><\/pre>\n<\/div>\n<\/div>\n
This can be resolved by mentioning the latest version number for opencv<\/div>\n
\n

Table of Contents<\/p>\n