Python Forum

Full Version: Why I am getting ModuleNotFoundError when I make an Exe file for tkinter GUI?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a simple code to use the LHS design of the experiment, and it works fine.

from tkinter import *
from pyDOE import *

root = Tk()
root.geometry("400x400")

n_points = IntVar()
n_features = IntVar()

label1 = Label(root, text="Initial No. sample points:")
label1.grid(row=0, column=0)

entry1 = Entry(root, textvariable=n_points)
entry1.grid(row=0, column=1)

label2 = Label(root, text="No. parameters:")
label2.grid(row=1, column=0)

entry2 = Entry(root, textvariable=n_features)
entry2.grid(row=1, column=1)

label3 = Label(root)
label3.grid(row=3, column=0, columnspan=2)

def LHS():
    lhs_design = lhs(n_features.get(), samples=n_points.get(), criterion="corr")
    label3.config(text="your design is:" + str(lhs_design))

mybutton = Button(root, text="Calculate!", command=LHS)
mybutton.grid(row=2, column=0, columnspan=2)

root.mainloop()
I want to create an Exe file using pyinstaller. I follow these steps:

1. put mycode.py in a folder.
2. open cmd, and I change the directory to the folder
3. run pyinstaller --onefile -w mycode.py
4. Then in the created dist folder, there would be an Exe file

however, when I run the exe file, I get this error:

Error:
Traceback (most recent call last): File "mycode.py", line 2, in <module> ModuleNotFoundError: No module named 'pyDOE'
Am I making a mistake somewhere in the code that I have run in cmd? or do I need to add the pyDOE package somewhere in the exe file folder?