Skip to content

PyInstaller with mip "NameError: name 'cbclib' is not define" #198

@simontt19

Description

@simontt19

Describe the bug
I am writing a program that solve MIP and it works well when I directly run the code. But after I use pyinstaller to pack my code into an executable file and then when I run that file this error comes out("NameError: name 'cbclib' is not define").

To Reproduce
The whole logic is complicated, so I only extract the relevant one.

  1. The script as below
from mip import Model
import tkinter as tk
import sys
def run():
    m = Model("load_planing") 
    r3 = str(m)
    r3_label.configure(text=r3)   

if __name__ == "__main__":
    window = tk.Tk()
    window.title('Multi-SOC Optimizer')
    window.geometry('640x480')
    window.configure(background='white')
    calculate_btn = tk.Button(window, text='Start!',command=run)
    calculate_btn.pack(side=tk.TOP)
    r3_label = tk.Label(window)
    r3_label.pack(side=tk.TOP)
    window.mainloop()
    sys.exit()
  1. Directly run the script on python is fine.

debug_on_python

  1. Use pyinstaller to pack the logic. pyinstaller -F -n mip_debug mip_debug.py

  2. Run the exe file after packed. => error

debug_pyinstaller

Expected behavior
Running the exe file's outcome should be same as directly run on python.

Desktop (please complete the following information):

  • Operating System, version: 64-bit operating system, win10
  • Python version:3.8.3
  • Python-MIP version (we recommend you to test with the latest version): 1.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    discardedThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions