8

Python does not identify the academic version of CPLEX.

I am using Linux, Ubuntu. I have Python 3.6. I installed CPLEX studio 12.9 (academic version installed via the file cplex_studio129.linux-x86-64.bin that I downloaded from ibm.biz/CPLEXonAI) installed at \opt directory.

I also installed the file setup.py that is available in /opt/ibm/ILOG/CPLEX_Studio129/cplex/python/3.7/x86-64_linux, using the terminal.

With all those, when I run my code in PyCharm, or in Terminal, I get: CPLEX Error 1016: Community Edition. Problem size limits exceeded. Purchase at https://ibm.co/2s0wqSa.

I found some similar questions, with helps suggesting to do correct the PYTHONPATH, but I could not understand what to do actually.

Mostafa
  • 2,104
  • 10
  • 28

2 Answers2

5

I've had this problem in the past with CPLEX Error 1016, though in Windows, and this is how I resolved it (assuming you have the correct installation of CPLEX on your machine and the appropriate python packages):

  • From the command prompt, go to the directory where CPLEX is installed (e.g. "C:\Program Files\IBM\ILOG\CPLEX_Studio129\python")
  • Run python setup.py install
  • Restart your system!

After doing these steps, when I navigate to the system path, I could see the path for CPLEX. You can check that on your machine too by doing the following (again, this is for windows but hopefully the idea is the same):

  • Go to Control panel > Edit the system environment variables > Advanced > Environment Variables...>
  • In the "User variables for your_name", you'll see "Path". Make sure you see the path for the cplex.exe and python version you have installed the setup.py for. For example:

    "C:\Program Files\IBM\ILOG\CPLEX_Studio129\cplex\python\3.6\x64_win64" and

    "C:\Program Files\IBM\ILOG\CPLEX_Studio129\cplex\bin\x64_win64\cplex.exe"

EhsanK
  • 5,864
  • 3
  • 17
  • 54
5

Thanks to all for the great suggestions. The thing that should be done is to install CPLEX setup.py in the site-packages of the python. But it is not enough. Actually, what worked was the suggestion to remove the community version first (as MarkL.Stone suggested).

So, what I suggest for further reference is to do something like:


1- Remove your CPLEX community version.

It can be in a folder like the following: /home/<<your-computer-name>>/.local/lib/python3.6/site-packages/cplex/

For this, you can open terminal and run:

rm -r /home/<<your-computer-name>>/.local/lib/python3.6/site-packages/cplex/


2- Install the CPLEX setup.py file.

For this, go to the folder that CPLEX is installed, and go to the following subfolder: opt/ibm/ILOG/CPLEX_Studio129/python (opt is where my CPLEX is installed). Then open the terminal and run:

sudo python setup.py install --home home/<<your-computer-name>>/.local/lib/python3.6/site-packages/cplex


Note that you should adjust the part <<your-computer-name>> in the commands in both steps.

Mostafa
  • 2,104
  • 10
  • 28
  • Thanks for the answer. The home option, python setup.py install --home /path/to/python, is really important when it comes to the virtual environment. – Edward Oct 04 '20 at 18:46