I tried Matt's brilliant workaround (Thanks mate!) on a conda 3.8 environment in January 2021, and it almost worked. I just had to edit a file inside cplex
to avoid the following exception, and make it work:
Exception: CPLEX 12.10.0.0 is not compatible with this version of Python.
So, to keep it comprehensive, here are Matt's steps, together with the extra edit I had to add:
- Download and unzip the wheel (in my case the closest was Linux, x86, py37) from here: https://pypi.org/project/cplex/#files
- Unzip it and make sure that the
purelib/cplex
directory is in your Python path (e.g. by opening the python interpreter inside the purelib
directory.
- now
import cplex
triggered the error above. This can be circumvented by editing the version_info < (3, 8, 0)
expression in cplex/internal/_pycplex_platform.py
, and replacing it with e.g. version_info < (3, 9, 0)
.
Now import cplex
will work!
PLEASE NOTE that this doesn't mean the installation is guaranteed to be successful. There is a reason why the IBM devs put that version guard in place. The library hasn't (likely) been tested on Python 3.8 and this workaround may be unstable! For prototyping purposes though it may be enough. Please let me know if you have any issues, and again thanks Matt for doing all the brainwork.
Cheers!
Andres
Issues
and there you can see if someone had similar problem. – Heigho