Reputation: 577
I would like to build my program that uses matplotlib
, which requires tkinter
.
The problem is that I can't include tkinter
, as it is not on pyPi (and it has now wheels).
I use Pynsist to build an NSIS installer. Here is the cfg:
[Application]
name=SineWave
version=1.0
# How to launch the app - this calls the 'main' function from the 'myapp' package:
entry_point=main:main
icon=sinewave.ico
[Python]
version=3.6.5
[Include]
# Packages from PyPI that your application requires, one per line
# These must have wheels on PyPI:
pypi_wheels = numpy==1.16.1
matplotlib==3.0.3
pyparsing==2.4.0
cycler==0.10.0
six==1.11.0
python-dateutil==2.8.0
kiwisolver==1.0.1
anaconda-project==0.8.2
If I run the builded exe it returns this:
Traceback (most recent call last):
File "C:\Users\Novot\AppData\Local\SineWave\SineWave.launch.pyw", line 31, in <module>
from main import main
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\main.py", line 2, in <module>
import matplotlib.pyplot as plt
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\pyplot.py", line 2372, in <module>
switch_backend(rcParams["backend"])
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\pyplot.py", line 207, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "importlib\__init__.py", line 126, in import_module
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\backends\backend_tkagg.py", line 1, in <module>
from . import _backend_tk
File "C:\Users\Novot\AppData\Local\SineWave\pkgs\matplotlib\backends\_backend_tk.py", line 5, in <module>
import tkinter as Tk
ModuleNotFoundError: No module named 'tkinter'
And also, is there a way to import all libraries that another one requires?
Upvotes: -1
Views: 404
Reputation: 577
I found it in the documentation: Pynsist documentation
"Because Pynsist makes use of the “bundled” versions of Python the tkinter module isn’t included by default. If your application relies on tkinter for a GUI then you need to find the following assets..."
Upvotes: 0