I'm trying to use the CPLEX library alongside Qiskit but keep getting the error.

 File "C:\Users\charl\.conda\envs\quantum\lib\site-packages\qiskit\optimization\algorithms\cplex_optimizer.py", line 58, in __init__
    raise MissingOptionalLibraryError(
qiskit.aqua.missing_optional_library_error.MissingOptionalLibraryError: "The 'CPLEX' library is required to use 'CplexOptimizer'. You can install it with 'pip install qiskit-aqua[cplex]'."

Now when of course run that command, I find that all these packages are already installed.

When I tried manually updating docplex, I got a warning saying the latest version was incompatible with qiskit and so I downgraded using pip to docplex 2.15.194, yet I still get the error.

What can I do to get docplex and Qiskit to talk to one another ?

I am using a windows 10 installation of qiskit in a conda environment.

  • $\begingroup$ Just a wild guess, if pip install qiskit-aqua[cplex] didn't work, have you tried conda install qiskit-aqua[cplex] as you said you are using a conda environment? I've never used conda personally, hence it's just a wild guess. $\endgroup$
    – Rammus
    Mar 15, 2021 at 14:42
  • $\begingroup$ Hi @Rammus, I've tried that but no dice: I think pip and conda act differently in this situation. I think the only role conda has played in this is just creating the environment ! Thanks all the same ! $\endgroup$
    – jolene
    Mar 15, 2021 at 14:56

1 Answer 1


I am also using Qiskit in conda environment and came over this issue some weeks ago. I had to use pip install docplex and pip install cplex in my environment.

Afterwards it worked. I should mention that I am using Linux but don`t think this matters here...

Please always be cautious when using both pip and conda in an environment as this can cause problems. This is described on anaconda website. I am using conda environment but only pip as installer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.