I'm trying to rerun an older code (about a year old). I have installed academic version of CPLEX 22.1.1 version and Python API and docplex in python. However, the dependencies have changed and therefore I am unable to run the code now.
Traceback (most recent call last):
File "C:\Users\...\Desktop\Jakhu\iitk\Sem3\Codes\Possibly_smart\Master.py", line 4, in <module>
from docplex.mp.model import Model
File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\docplex\mp\model.py", line 16, in <module>
from docplex.mp.aggregator import ModelAggregator
File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\docplex\mp\aggregator.py", line 14, in <module>
from docplex.mp.utils import is_number, is_iterable, is_iterator, is_pandas_series, \
File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\docplex\mp\utils.py", line 70, in <module>
__float_types.add(numpy.float_)
^^^^^^^^^^^^
File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\__init__.py", line 411, in __getattr__
raise AttributeError(
AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.. Did you mean: 'float16'?
I tried installing numpy version using pip install --force-reinstall numpy==1.19.5
and pip install docplex==2.10.154
to make it compatible but it still throws the same error.
I cannot change the aliases of numpy.float since they are arriving from docplex and are outside my control.
What is happening here? How do I resolve this? Many thanks for reading!
docplex
version?pypi
lists an Apr 2024 release which should work with the current numpy. 2.27.239. 2.10 dates back to 2019!numpy==2.0.0b1
anddocplex==2.27.239
and the issue persists. CPLEX is 22.1.1.0 academic license.np.float_ = np.float64
in your script after importingnumpy
? You can overwrite or create new attributes of an imported package, although it is generally not recommended.