From b6d41e43544b43919314d888c81283083c906c3e Mon Sep 17 00:00:00 2001 From: Holt59 Date: Fri, 9 May 2025 15:38:38 +0200 Subject: [PATCH] Fix issue with 'docplex config --upgrade' within venv. --- docplex/util/cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docplex/util/cli.py b/docplex/util/cli.py index 88e1ca4..a5553c2 100644 --- a/docplex/util/cli.py +++ b/docplex/util/cli.py @@ -66,7 +66,7 @@ def get_cplex_info(): # way of unloading the 'cplex' module and since we will copy # a new shared object over the already loaded one, leaving the # cplex module loaded can create a segmentation fault. - out = subprocess.run(["python", "-c", sub_program], capture_output=True) + out = subprocess.run([sys.executable, "-c", sub_program], capture_output=True) if out.returncode == 0: stdout = out.stdout.decode("utf-8").strip().split(" ") if stdout[0] != "Error:": @@ -78,6 +78,10 @@ def copy_so(cos): cos = os.path.realpath(cos) pcplex, version = get_cplex_info() + if version is None: + print("ERROR: did not find 'cplex' package") + return + version_mneumonic = "".join(version.split(".")[:3]) so_name = get_so_name(version_mneumonic) cpo_name = get_cpo_name(version_mneumonic)