Reputation: 105
Hello please i need help in compiling my kivy app to work as dekstop app i'm using pyinstaller and then i've downloaded packages like kivy,kivymd using pip but i'm getting the error below whenever i tried running the app from cmd to see the error log while the app keeps crashing on startup:
Traceback (most recent call last):
File "kivy\lang\parser.py", line 472, in execute_directives
ModuleNotFoundError: No module named 'kivymd.effects'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "kivy\lang\parser.py", line 474, in execute_directives
ModuleNotFoundError: No module named 'kivymd.effects'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 28, in <module>
from kivymd.uix.datatables import MDDataTable
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
File "kivymd\uix\datatables.py", line 307, in <module>
File "kivy\lang\builder.py", line 373, in load_string
File "kivy\lang\parser.py", line 402, in __init__
File "kivy\lang\parser.py", line 508, in parse
File "kivy\lang\parser.py", line 485, in execute_directives
kivy.lang.parser.ParserException: Parser: File "<inline>", line 3:
...
1:
2:#:import DEVICE_TYPE kivymd.material_resources.DEVICE_TYPE
>> 3:#:import StiffScrollEffect kivymd.effects.stiffscroll.StiffScrollEffect
4:
5:
...
Unable to import package 'kivymd.effects.stiffscroll.StiffScrollEffect'
And then this is my main.spec file where i tried to import kivy,kivymd but still the application keeps crashing on startups.
import kivy
import kivymd
from kivy_deps import sdl2, glew
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
added_files = [
( 'C:\\wamp64\\www\\implementation\\kivy_venv\\trial\\advan.txt', '.' ),
( 'C:\\wamp64\\www\\implementation\\kivy_venv\\trial\\inspirational_quotes.txt', '.' ),
( 'C:\\wamp64\\www\\implementation\\kivy_venv\\trial\\user_data.json', 'json' ),
( 'C:\\wamp64\\www\\implementation\\kivy_venv\\trial\\images', 'images' ),
]
a = Analysis(['main.py'],
pathex=['C:\\wamp64\\www\\implementation\\kivy_venv\\trial'],
binaries=[],
datas=added_files,
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
strip=False,
upx=True,
upx_exclude=[],
name='main')
In my main.py file i'm making use of classes like DataTable, Clock, Carousel, MDNavigation and images from kivy,kivymd which i think might have something to do with the stiffscroll effect class.
from kivy.app import App
from kivymd.app import MDApp
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.uix.textfield import MDTextFieldRound
#----------------#----------------#-------------#------------#
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.anchorlayout import AnchorLayout
#----------------#----------------#-------------#------------#
from kivy.uix.label import Label
from kivy.uix.widget import Widget
#----------------#----------------#-------------#------------#
from kivy.uix.image import Image
from kivy.properties import ObjectProperty
from kivy.uix.screenmanager import ScreenManager,Screen
#----------------#----------------#-------------#------------#
import os
import sys
import datetime
import re
#----------------#----------------#-------------#------------#
from kivy.metrics import dp
from kivy.lang import Builder
from kivymd.uix.datatables import MDDataTable
from kivy.storage.jsonstore import JsonStore
from kivy.clock import Clock
from kivy.factory import Factory
#----------------#---------Voice-------#-------------#------------#
import speech_recognition as s_r
Upvotes: 0
Views: 423
Reputation: 11
I was having the same problem and I was trying solutions.
What worked was to add to my imports in main.py the line "import kivymd.effects.stiffscroll"
and run pyinstaller main.spec
again.
I can't explain why but the application finally opened after this addition, and it was the ONLY change I made, I didn't create classes or use the package.
Upvotes: 1