2

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.

sunadorer
  • 3,855
  • 34
  • 42
Faraz Ramtin
  • 345
  • 3
  • 11

2 Answers2

4

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.

rkersh
  • 4,447
  • 2
  • 22
  • 31
  • I just have different version of Python. How can I specify specific version of my Python install the 'setup.py'? – Faraz Ramtin Dec 13 '16 at 14:51
  • Also, is there any compatibility issue with Python 3.5.2 and CPLEX 12.6 ? – Faraz Ramtin Dec 13 '16 at 15:09
  • If you want to use Python 3.5 you'll have to use CPLEX 12.7. 12.6 supports 3.4. See the [detailed system requirements](http://www-01.ibm.com/support/docview.wss?uid=swg27019100). – rkersh Dec 13 '16 at 15:51
  • I have Python 3.5.2 and Cpelx 17.0 installed on my pc. there is no 'setup.py' in the address '.../python/version/platform'. I could find it on other address, but when I run the install from the consul, I got this msg --> C:\Program Files\IBM\ILOG\CPLEX_Studio127\cplex\python\3.5\x64_win64>python -->setup.py install -->running install -->running build -->running build_py -->creating build -->error: could not create 'build': Access is denied – Faraz Ramtin Dec 13 '16 at 19:14
  • I guess I found my answer: http://stackoverflow.com/questions/23362217/error-while-installing-cplex-12-6-for-python – Faraz Ramtin Dec 13 '16 at 20:04
  • I have installed the CPLEX_studio_commnity128 on a Linux machine. I got this error and tried the fix as given here. But did not work. I have even tried adding the PYTHONPATH to this folder as well. But with no help Cplex Home: `/opt/ibm/ILOG/CPLEX_Studio_Community128` when I go in python directory I don't see a directory listing all python versions. I used the command `sudo python setup.py install` and `sudo python3 setup.py install` Python version `3.5` and `3.6` The error still persists. Can anyone give me a workaround for this? – JAugust May 08 '18 at 03:21
  • @JAugust, based on your comment, the path to the CPLEX Python API should be, for example `/opt/ibm/ILOG/CPLEX_Studio_Community128/cplex/python/3.5/x86-64_linux/`. Alternately, since you're using the community edition anyway, you can just `pip install cplex` (it is available on PyPI now). – rkersh May 09 '18 at 17:29
  • @rkersh Thanks for the input, I tried the same and lot of issues persisted. I doubt my python installations a lot for this disparity. However, let me tell you how I found my solution. I have done exactly as you said, and it was giving me some error related to `docloud` and as a last resort, I started issuing the commands with `sudo` and to my surprise, all the errors went away and the program starting giving me the output. The exact same command which was giving me notorious errors started working seamlessly. I do not know the reason why, but it worked like a charm. Thanks for the inputs. – JAugust May 09 '18 at 18:30
1

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

s3b4s
  • 93
  • 6