coin-or / coin-or/python-mip

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

Open
#198 12 comments 0 reactions 0 assignees View on GitHub
discarded
Dominant language
Linear Programming
Stars
600
Forks
108
PR merge metrics
No merged PRs in 30d

Description

**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()
```

2. Directly run the script on python is fine.
debug_on_python

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

4. 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.