IBMDecisionOptimization / Decision-Optimization-with-CPLEX-samples

20 stars 9 forks source link

Python exe and cplex dll #2

Closed imane255 closed 3 years ago

imane255 commented 4 years ago

Hello everyone, i used python to model and solve an optimization problem. and it works very well in jupyter. i generated an exe. (using pyinstaller filename.py). i worked well.. i put the cplex dll in the same folder as the python exe. however, when i try to run my exe..i have this error " c:\users\appdata\local\continuum\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py:623: MatplotlibDeprecationWarning: The MATPLOTLIBDATA environment variable was deprecated in Matplotlib 3.1 and will be removed in 3.3. exec(bytecode, module.dict) sys:1: DtypeWarning: Columns (6,88,115,116) have mixed types. Specify dtype option on import or set low_memory=False. Traceback (most recent call last): File "Overseas_RFQ.py", line 209, in solution= mdl.solve(log_output=True) File "site-packages\docplex\mp\model.py", line 3589, in solve File "site-packages\docplex\mp\model.py", line 776, in fatal File "site-packages\docplex\mp\error_handler.py", line 210, in fatal docplex.mp.utils.DOcplexException: CPLEX runtime not found: please install CPLEX or solve this model on DOcplexcloud [7896] Failed to execute script Overseas_RFQ " i dont understand why he doesn't find cplex..knowing that the jupyter code works very well. I use Docplex

Does anyone have any suggestion to solve this problem? Thank you in advance! :)

vlkong commented 4 years ago

Hi,

My understanding is that you need to build your program adding cplex.dll to pysinstaller data. Please have a look at here: https://stackoverflow.com/questions/38791685/how-do-i-include-dll-file-in-executable-using-pyinstaller.

The pyinstaller manual has clear instructions on how to include binaries: https://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-binary-files

Note that (DecisionOptimization team at IBM) provide support if you have problems with cplex or docplex. However, providing support for pyinstaller is out of scope, you should contact pyinstaller's support https://www.pyinstaller.org/support.html .

Thanks