Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docplex is not compatible with Python 3.9 #25

Closed
t-imamichi opened this issue Feb 8, 2021 · 1 comment
Closed

Docplex is not compatible with Python 3.9 #25

t-imamichi opened this issue Feb 8, 2021 · 1 comment

Comments

@t-imamichi
Copy link
Collaborator

t-imamichi commented Feb 8, 2021

Information

  • Qiskit Optimization version: NA
  • Python version: Python 3.9.1
  • Operating system: macOS 11.2

What is the current behavior?

The latest Docplex 2.20.204 does not work with Python 3.9

Related to #24

Steps to reproduce the problem

from docplex.mp.model import Model
a = Model()
x = a.binary_var()
print(a.add_constraint(x <= 1))

Python 3.8

x1 <= 1

Python 3.9

Traceback (most recent call last):
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/environment.py", line 290, in get_cplex_module
    import cplex  #@UnresolvedImport
ModuleNotFoundError: No module named 'cplex'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ima/tasks/1_2021/qiskit/aqua/tmp/c.py", line 2, in <module>
    a = Model()
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/model.py", line 417, in __init__
    self._environment = self._make_environment()
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/model.py", line 181, in _make_environment
    env = Environment.get_default_env()
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/environment.py", line 427, in get_default_env
    Environment._default_env = Environment.make_new_configured_env()
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/environment.py", line 422, in make_new_configured_env
    return Environment(start_auto_configure=True)
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/environment.py", line 84, in __init__
    self.auto_configure(logger=logger)
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/environment.py", line 220, in auto_configure
    self.check_cplex(logger=logger)
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/environment.py", line 328, in check_cplex
    cplex = self.get_cplex_module(logger=logger)
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/environment.py", line 314, in get_cplex_module
    cplex = load_cplex_from_cos_root(loc) if loc else None
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/environment.py", line 286, in load_cplex_from_cos_root
    return load_cplex(full_path, version=version)
  File "/Users/ima/envs/dev39/lib/python3.9/site-packages/docplex/mp/environment.py", line 261, in load_cplex
    raise FileNotFoundError("Could not load module from %s" % module_location)
FileNotFoundError: Could not load module from /Applications/CPLEX_Studio201/cplex/python/3.9/x86-64osx/cplex/__init__.py

What is the expected behavior?

Suggested solutions

We should configure setup.py and requirements.txt so that Python 3.9 does not install docplex.

@t-imamichi
Copy link
Collaborator Author

I merge this issue with #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant