I do not succeed to install CPLEX's Python API (version 22.1) on a MacBook with M1 chip (macOS Ventura - 13.1). Tried with several Python versions (3.8, 3.9, 3.10).
Steps taken:
- Created a new Python environment, and loaded it. E.g., 3.10.9.
- Installed the CPLEX package with
python /Applications/CPLEX_Studio221/python/setup.py install
- Checked if the package is there with
pip list
- Tried to import the package with
import cplex
=> Exception
The ImportError
is thrown here:
from cplex._internal.py310_cplex2210 import *
dlopen(/Users/christian/workspace/venvs/python-examples_3_10_9/lib/python3.10/site-packages/cplex-22.1.0.0-py3.10.egg/cplex/_internal/py310_cplex2210.so, 0x0002): tried: '/Users/christian/workspace/venvs/python-examples_3_10_9/lib/python3.10/site-packages/cplex-22.1.0.0-py3.10.egg/cplex/_internal/py310_cplex2210.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/christian/workspace/venvs/python-examples_3_10_9/lib/python3.10/site-packages/cplex-22.1.0.0-py3.10.egg/cplex/_internal/py310_cplex2210.so' (no such file), '/Users/christian/workspace/venvs/python-examples_3_10_9/lib/python3.10/site-packages/cplex-22.1.0.0-py3.10.egg/cplex/_internal/py310_cplex2210.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
Seems something related to the architecture: have 'x86_64', need 'arm64'
, but really no idea what is going on.
CodePudding user response:
You should use CPLEX 22.1.1
With respect to platforms, this release introduces support for Windows Server 2022 and MacOS Ventura. It also adds an ARM64 port for MacOS, allowing users to run CPLEX Optimization Studio natively on this architecture.