j4321 / tkcalendar

Calendar widget for Tkinter
https://pypi.python.org/pypi/tkcalendar
GNU General Public License v3.0
98 stars 33 forks source link

Pyinstaller: no module named tkcalendar #40

Closed Areef-abhiram closed 5 years ago

Areef-abhiram commented 5 years ago

after generating the .exe by using pyinstaller im facing "no module named tkcalendar" some times and some times "no module named babel.numbers" .kindly help me to get out from this issue

j4321 commented 5 years ago

I think a similar issue (#32) has already been reported and I wrote a section in the documentation https://tkcalendar.readthedocs.io/en/stable/howtos.html#pyinstaller to address it. Have you tried it?

VShkaberda commented 5 years ago

I had the same problem. According to https://tekrecipes.com/2019/04/17/modulenotfounderror-no-module-named-babel-numbers/ I fixed this by adding from babel.numbers import * to the calendar.py. Maybe it is worth to consider adding this import permanently.

j4321 commented 5 years ago

@VShkaberda The issue is not directly related to tkcalendar, it comes from the fact that Pyinstaller does not detect second level imports. There is a solution to fix it by giving explicit import instructions to Pyinstaller. Since not everybody using tkcalendar uses Pyinstaller I won't add unnecessary imports into tkcalendar's code.

VantaTree commented 1 year ago

I was able to get tkcalendar into an exe with pyinstaller by adding data: --add-data "<path to python>/Lib/site-packages/tkcalendar;tkcalendar" --add-data "<path to python>/Lib/site-packages/babel;babel"

This included babel/numbers.py which seemed to solve the problem, or you can manually copy-paste it from site-packages (no need to add data babel).