
It does look like an installation issue.īy the way, I ran pip list to check which version of docplex and cplex are found on my system.
INSTALL CPLEX FOR PYTHON UPDATE
The way I updated docplex seems to only update part of the docplex. It appears that this file(version.py) is a part of an older version of docplex. # Source file provided under Apache License, Version 2.0, January 2004,

ImportError: cannot import name 'latest_cplex_major' from 'docplex.version' (C:\Python37\lib\site-packages\docplex\version.py) And this is what's in the C:\Python37\lib\site-packages\docplex\version.py: There is no cplex(python) on this machine.įile "C:\Python37\lib\runpy.py", line 193, in _run_module_as_mainįile "C:\Python37\lib\runpy.py", line 85, in _run_codeįile "C:\Python37\lib\site-packages\docplex\mp\check_list.py", line 148, in įile "C:\Python37\lib\site-packages\docplex\mp\check_list.py", line 48, in run_docplex_check_listįrom docplex.version import latest_cplex_major, latest_cplex_minor I updated cplex(python) from 12.9 to 20.1.0.1 in the same way as I updated docplex.Īnd yes, on my other machine, docplex 2.20.204 works fine with CPLEX Optimization Studio 12.9. And the 'Cplex' mentioned in my original post refers to CPLEX Optimization Studio.


I forgot to mention that this machine is also installed with cplex 20.1.0.1(python). It was in the machine installed with docplex 2.20.204, cplex 20.1.0.1, and CPLEX Optimization Studio 20.1 that I got the above error when trying to solve my model with docplex.
INSTALL CPLEX FOR PYTHON INSTALL
Python -m pip install -upgrade pip Then installed docplex: pip install -ignore-installed -U docplexAfter updating both Cplex and docplex, I tried to solve my model. Subject: Cplex 20.1 is not compatible with docplex 2.20.204 This is why I believe that the problem behind this is that Cplex 20.1 is not compatible with docplex 2.20.204.īoth of my machines are with win10 and python 3.7.3. PS, I have another machine installed with Cplex 12.9 and docplex 2.20.204. Return self._lfactory._new_constraint_block1(cts)įile "c:\python37\lib\site-packages\docplex\mp\mfactory.py", line 835, in _new_constraint_block1įile "c:\python37\lib\site-packages\docplex\mp\mfactory.py", line 840, in _post_constraint_blockĬt_indices = self._engine.create_block_linear_constraints(posted_cts)įile "c:\python37\lib\site-packages\docplex\mp\cplex_engine.py", line 747, in create_block_linear_constraintsįile "c:\python37\lib\site-packages\docplex\mp\cplex_engine.py", line 133, in fast_add_linearĪttributeError: 'Environment' object has no attribute '_apienc'īefore I updated anything, docplex 2.9.133 worked fine with Cplex 12.9. Mdl.add_constraints(mdl.sum(x for i in V_without_Vd if i != j for k in K) = 1 for j in L_B)įile "c:\python37\lib\site-packages\docplex\mp\model.py", line 3075, in add_constraints However, I got the following error:įile "D:/Python/Cplex/E-HVRPMBTW V3.py", line 399, in Python -m pip install -upgrade pip Then installed docplex: pip install -ignore-installed -U docplexĪfter updating both Cplex and docplex, I tried to solve my model. I got the same error as the user in the link when trying to uninstall docplex, so f irstly I updated pip from 19.0.3 to 21.1.1 with: Hidden page that shows all messages in a thread Before installing the newest version of Cplex(20.1.0), I have updated my docplex from 2.9.133 to 2.20.204 according to this link:

I have updated my Cplex from 12.9 to 20.1.0(Both under IBM Academic Initiative).
