model.solve() method is not working ("CPLEX DLL not found") for DOcplex for Python

7.3k views Asked by At

I build my mathematical model using DOcplex IBM package for Python. I am sure that the other part of the modeling is correct, however when the call to Model.solve() is executed, and I get the following error:

"CPLEX DLL not found: please provide DOcplexcloud credentials"

I have CPLEX Studio 12.6 installed on my pc, and I want to solve the problem locally not on cloud.

2

There are 2 answers

8
rkersh On BEST ANSWER

It sounds like you do not have the CPLEX Python API "installed". By default, when you install CPLEX Optimization Studio (aka COS) the Python bindings are copied onto your disk, but they aren't associated with any of your local Python installations.

If you follow the instructions on the Setting up the Python API of CPLEX page, you should be able to do a local solve. In short, you can either run the setup.py script under yourCPLEXhome/python/VERSION/PLATFORM, or you can set the PYTHONPATH environment variable.

0
s3b4s On

Are you using Anaconda? I solved it by running the following in the CPLEX install directory:

python setup.py install --home <PackagesHome>\cplex

with <PackagesHome> as <user>\AppData\Local\Continuum\Anaconda2\Lib\site-packages