Search code examples
pythoncplexpyomo

Persistant CPLEX - module cplex has no attribute cplex


I am currently creating a model in pyomo and using cplex as a solver(persistant cplex) to be specific which uses the python API.

I tried running this on my local windows machine and after installing setup.py it work. However, when i switch to run this on my linux server, I keep getting the error "Module cplex has no attribute CPLEX". It is also asking to checking if I have gotten my python bindings right.

CPLEX : v12.10 Python : v3.6 (64 bit)

I have tried creating virtual environments and adding the original cplex installation location(/opt/...) to my PATH but to no avail.

Let me know if you need any additioanl information and any help would be apprecaited


Solution

  • The root issue is that persistent solvers needs a different solver interface. The below line of code run in your environment will install the C++ version of the solver and the CPLEX persistent library will run. Make sure there are no errors when you run this (you might need to install other packages)

    pyomo get-extensions