0

I am trying to run an optimization program using pulp and cplex I have installed cplex studio. I have change the path name as instructed

Name: Path
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community129\cplex\python\3.7\x64_win64\cplex\_internal

but I am still receiving the error CPLEX_PY: Not Available. I was wondering if anyone else was able to solve this problem or what I'm missing.

Austin Johnson
  • 634
  • 6
  • 17

1 Answers1

1

At first, I thought you were trying to use the CPLEX_CMD solver, but I see that you want to use CPLEX_PY instead. The former relies on the CPLEX interactive (cplex.exe) being in your PATH environment variable. The later requires that you either install the CPLEX Python API or include it in your PYTHONPATH environment variable. Please see the documentation here for setting up the CPLEX Python API.

Based on what you have in your question, you could run setup.py like so:

cd "C:\Program Files\IBM\ILOG\CPLEX_Studio_Community129\cplex\python\3.7\x64_win64"
python setup.py install

Or, you could add the following to PYTHONPATH:

C:\Program Files\IBM\ILOG\CPLEX_Studio_Community129\cplex\python\3.7\x64_win64

See how to do this here.

In any case, you need to make sure that you can do the following from the python prompt:

>>> import cplex

Also, make sure you are using a 64-bit python.

rkersh
  • 4,197
  • 2
  • 20
  • 29
  • I have added the PYTHONPATH, but I am still receiving the same error. – Austin Johnson May 30 '19 at 21:08
  • ImportError: DLL load failed: %1 is not a valid Win32 application. When trying to import cplex – Austin Johnson May 30 '19 at 21:13
  • Think the 64 bit might be my problem – Austin Johnson May 30 '19 at 21:16
  • Ok so when I switched back to Python2 it says cplex isn't compatible with python2 and when i download python3 i can only download the 32-bit – Austin Johnson May 30 '19 at 21:30
  • You need to make sure that you install the correct cplex package for the version of python you are using. Under "C:\Program Files\IBM\ILOG\CPLEX_Studio_Community129\cplex\python" you will see a directory for 2.7, 3.6, and 3.7. The versions supported are different depending on the version of CPLEX you are working with, but it looks like you are using CPLEX 12.9 so this should be correct in your case. – rkersh May 30 '19 at 21:54