Decision Optimization

 View Only

 python installation for CPLEX Optimization Studio 22.1.2

Jörg Schepers's profile image
Jörg Schepers posted Fri March 28, 2025 09:14 AM

With COS 22.1.1 one could install cplex for python using the script "python/setup.py" (which used the wrappers in "cplex/python/3.x/...)
In COS 22.1.2 script and wrappers are not part of the product anymore.
"pip install cplex" installs only the community edition.
In the docplex doc I found nothing about installing a commercial cplex studio edition.

Can anybody help?

Thanks in advance

Jörg

Cédric Doens's profile image
Cédric Doens

Hello Jörg,
You can upgrade your cplex python module
 from your current Python activated environment by:
(python-env-3.11) ~$
pip install cplex docplex
docplex config --upgrade $COS_INSTALL_DIR

Jörg Schepers's profile image
Jörg Schepers

Hello Cédric,

thanks for your answer.

For some reason with python 3.12 the cplex 22.1.2 will be installed immediately by pip. (even with cleared cache)

Best regards

Jörg

Cédric Doens's profile image
Cédric Doens

Indeed `pip install cplex` still installs cplex python module, in its "evalution/limited" edition.

`docplex config --upgrade $COS_INSTALL_DIR` upgrades cplex python module to the "full" edition.
In practice by making the cplex python module use the "unlimited" binaries of the $COS_INSTALL_DIR

Regards

Jörg Schepers's profile image
Jörg Schepers

I had to do a little change, because in docplex/util/cli.py line 79 the call get_cplex_info() returned None for some reason. 

I checked already

1) that the COS-path was correct

2) that the right python was used in the subprocess created in Line 69

3) that the inline script (Lines 57-61) works in a python shell outside the script

It failed anyway.

After decommenting Line 79 and inserting version = '22.1.2.0' after it the script worked fine and it copied the correct binaries.

Best regards

Jörg