0

I am facing an error like below, while I have installed docplex module and am using python 3.7/3.8. Would you please help me?

Traceback (most recent call last):
  File "C:/Users/xxx/PycharmProjects/pythonProject/EPC _LTC.py", line 155, in <module>
    solution = mdl.solve(log_output=True)
  File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\model.py", line 4222, in solve
    return self.fatal("CPLEX runtime not found: please install CPLEX or solve this model on DOcplexcloud")
  File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\model.py", line 894, in fatal
    self._error_handler.fatal(msg, args)
  File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\error_handler.py", line 210, in fatal
    raise DOcplexException(resolved_message)
docplex.mp.utils.DOcplexException: CPLEX runtime not found: please install CPLEX or solve this model on DOcplexcloud
mdslt
  • 155
  • 1
  • 10

1 Answers1

1

docplex is only the modeling layer - you need to install CPLEX separately. If you can use the community edition, you can just pip install cplex in your python environment. If you are using a commercial edition, you need to install the CPLEX python api as instructed here: https://www.ibm.com/docs/en/icos/20.1.0?topic=cplex-setting-up-python-api

  • This is not working. I'm using Spyder and I get the same error even if I `pip install cplex`. – Parseval Mar 21 '22 at 14:57
  • 1
    @Parseval are you sure that your `pip install cplex` installs cplex in the same python environment you run Spyder? – Viu-Long Kong Mar 23 '22 at 09:14
  • 1
    Aparently I just needed to restart the krenel in Spyder after installing cplex. It worked after that. Thank you! – Parseval Mar 23 '22 at 12:37