1

I have been struggling with this for a while. I have used py2exe and cx_freeze to package everything. I am using a 32 bit machine and Everything works fine and the interface opens up and everything just that I know the entire puLP package is not being copied correctly into the package. I know this because the solver does not work. Inside both library zips in the packages created by py2exe and cx_freeze, there are only .pyc files included where PuLP has cbc.exe and other file types that make the solver work.

Is there any work around this? I have tried copying the actual PuLP package into the library.zip as well as into the dist folder and that didn't work.

Here is the setup I used for py2exe: import sys from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["pulp"], 
                    "icon": "icon.ico",
                    "include_files": ["icon.ico","cbc.exe","cbc-32","cbc-64","cbc-osx-64","CoinMP.dll"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "my_app",
        version = "0.1",
        options = {"build_exe": build_exe_options},
        executables = [Executable("my_app.py", base=base)])

I received the following error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "Tkinter.pyc", line 1470, in __call__
  File "my_app.py", line 796, in <lambda>
  File "my_app.py", line 467, in branchAndBound
  File "pulp\pulp.pyc", line 1619, in solve
AttributeError: 'NoneType' object has no attribute 'actualSolve'

EDIT I tried to change the paths to cbc.exe and CoinMP.dll but that didn't really work either. I am probably missing something.

I changed the following inside solvers.py in the PuLP package:

try:
    coinMP_path = config.get("locations", "CoinMPPath").split(', ')
except configparser.Error:
    coinMP_path = ['/Users/al/Desktop/my_app/build/exe.win32-2.7']

try:
    cbc_path = config.get("locations", "CbcPath")
except configparser.Error:
    cbc_path = '/Users/al/Desktop/my_app/build/exe.win32-2.7'

try:
    pulp_cbc_path = config.get("locations", "PulpCbcPath")
except configparser.Error:
    pulp_cbc_path = '/Users/al/Desktop/my_app/build/exe.win32-2.7'

What am I missing or doing wrong?

4

0 回答 0