It’s pretty easy.
CPLEX Optimization Studio is only supposed to be compatible with Python 3.7 and 3.8. You can check this by looking at [cplex_home]/cplex/python/ - there are only two folders, 3.7 and 3.8. No folder for 3.9.
For Python to detect CPLEX, you’re supposed to add [cplex_home]/cplex/python/3.9 to PYTHONPATH. And it doesn’t exist. But you can do the following:
-
add [cplex_home]/cplex/python/3.8 to PYTHONPATH.
-
edit [cplex_home]/cplex/python/3.8/[platform]/cplex/_internal/_pycplex_platform.py from “3.9.0” to “3.10.0”
-
edit [cplex_home]/cplex/python/3.8/[platform]/setup.py so check_version checks for 3.9 instead of 3.8
And that’s it. With this, you’re NOT changing the software itself, just the version checking
I don’t know if this might cause problems, but for now it has worked for me. I don’t think it will cause any problems because the Community Edition that you can install for python 3.9 with pip install cplex
does work, and it’s version 20.1 as well.
I hope this was useful for someone out there!