Open simontt19 opened 3 years ago
I have the same error! Did you manage to fix it?
Same here with slightly different versions. Any resolution?
This is not actually a bug with this library. Rather, you need to specify that the required .dll
file should be bundled with pyinstaller
by using an --add-binary
argument.
@nickpgill @labaude @simontt19 Does the comment of @rschwarz fixes your problem?
Sorry for the delay in replying... I tried to make use of the suggestion from @rschwarz but I was not able to figure out how to use the --add-binary argument. If you can give me a clue here, then I will follow this up and see if I can make it work...
On Tue, 5 Apr 2022 at 20:39, Sebastian Heger @.***> wrote:
@nickpgill https://github.com/nickpgill @labaude https://github.com/labaude @simontt19 https://github.com/simontt19 Does the comment of @rschwarz https://github.com/rschwarz fixes your problem?
— Reply to this email directly, view it on GitHub https://github.com/coin-or/python-mip/issues/198#issuecomment-1089243562, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIC6SVOBT67BVJGHBVBGUXDVDSJHNANCNFSM474RQ6ZQ . You are receiving this because you were mentioned.Message ID: @.***>
I have not tried it with python-mip and Cbc, but here's how I called pyinstaller (on Windows) for a past project that used PySCIPOpt:
pyinstaller --onefile ^
--add-binary "%SCIPOPTDIR%\bin\libscip.dll;." ^
--add-binary "%SCIPOPTDIR%\bin\tbb.dll;." ^
--windowed ^
mypackage/myapp.py
where SCIPOPTDIR
was previously defined via set SCIPOPTDIR=C:\Program Files\SCIPOptSuite 7.0.2
. The result was a portable .exe
that included the two relevant .dll
s.
I'm no longer sure what the ;.
suffix after the .dll
path means :disappointed:
Thanks Robert, I appreciate your help with this. I'll see if I can make this work! Nick
On Mon, 25 Apr 2022 at 09:36, Robert Schwarz @.***> wrote:
I have not tried it with python-mip and Cbc, but here's how I called pyinstaller (on Windows) for a past project that used PySCIPOpt:
pyinstaller --onefile ^
--add-binary "%SCIPOPTDIR%\bin\libscip.dll;." ^ --add-binary "%SCIPOPTDIR%\bin\tbb.dll;." ^ --windowed ^ mypackage/myapp.py
where SCIPOPTDIR was previously defined via set SCIPOPTDIR=C:\Program Files\SCIPOptSuite 7.0.2. The result was a portable .exe that included the two relevant .dlls.
I'm no longer sure what the ;. suffix after the .dll path means 😞
— Reply to this email directly, view it on GitHub https://github.com/coin-or/python-mip/issues/198#issuecomment-1108255030, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIC6SVLCY4DHLWQQ5JZ32ZLVGZKRPANCNFSM474RQ6ZQ . You are receiving this because you were mentioned.Message ID: @.***>
@nickpgill Will you share some insights with us so that I can see if there is some issue on python-mip side or that I can move it to the discussion section. Otherwise, I will close this issue.
you can write a hook-mip.py
file there in a folder named hooks
(create a folder hooks
and touch a file hooks/hook-mip.py
), and the code of hook-mip.py
is:
from PyInstaller.utils.hooks import collect_all
def hook(hook_api):
packages = ['mip']
for package in packages:
datas, binaries, hiddenimports = collect_all(package)
hook_api.add_datas(datas)
hook_api.add_binaries(binaries)
hook_api.add_imports(*hiddenimports)
then, you can use pyinstaller as: pyinstaller -D xxx.py --additional-hooks-dir=./hooks/
, then it will work.
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.
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()