Search code examples
cplexpyomo

How to connect cplex and pyomo?


opt = SolverFactory('cplex', executable="/Applications/CPLEX_Studio_Community129/cplex/bin/x86-64_osx/cplex")

If using the executable option (as above), it works. If not, we get the following error:

ApplicationError: No executable found for solver 'cplex'

Solution

  • If you don't want to specify the path with the executable option, you need to add the following directory to your PATH environment variable:

    /Applications/CPLEX_Studio_Community129/cplex/bin/x86-64_osx
    

    For example, you can do this from the command line, like so:

    export PATH=$PATH:/Applications/CPLEX_Studio_Community129/cplex/bin/x86-64_osx
    

    If that works, then you can make this permanent by adding it to your ~/.bash_profile using the technique described here