Decision Optimization

 View Only
  • 1.  CPLEX on macbook M1

    Posted Thu August 19, 2021 09:49 AM
    Hello,

    I have a problem using CPLEX 201 concert technology C++ on macbook chip M1 with MacOS 11.2.3. Previously, I created a copy of the Terminal on Rosetta2, and I was able to run CPLEX through "makefile" for C++. However, it is now impossible for me to use that approach after updating some apps, I get the following error (If anyone can help me):

    make all_cpp

    clang++ -O0 -m64 -O -fPIC -fexceptions -DNDEBUG -DIL_STD -stdlib=libc++ -I/Applications/CPLEX_201/cplex/include -I/Applications/CPLEX_201/concert/include  -L/Applications/CPLEX_201/cplex/lib/x86-64_osx/static_pic -L/Applications/CPLEX_201/concert/lib/x86-64_osx/static_pic -o modelo modelo.o -lconcert -lilocplex -lcplex -m64 -lm -lpthread -framework CoreFoundation -framework IOKit -stdlib=libc++ 

    ld: warning: ignoring file modelo.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64

    Undefined symbols for architecture x86_64:

      "_main", referenced from:

         implicit entry/start for main executable

    ld: symbol(s) not found for architecture x86_64

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    make[1]: *** [modelo] Error 1

    make: *** [all] Error 2



    ------------------------------
    Omar Jorge Ibarra Rojas
    ------------------------------


  • 2.  RE: CPLEX on macbook M1

    Posted Thu August 19, 2021 09:57 AM
    With M1 chip, you need to tell the OS in which mode you want to launch a command:
    ``` arch -x86_64 make  ``` for currently support intel architecture.

    ------------------------------
    Vincent Beraudier
    ------------------------------



  • 3.  RE: CPLEX on macbook M1

    Posted Thu August 19, 2021 10:13 AM
    It works fine! thanks!

    ------------------------------
    Omar Jorge Ibarra Rojas
    ------------------------------



  • 4.  RE: CPLEX on macbook M1

    Posted Sat May 21, 2022 12:45 PM
    I have the same problem and I can not run my code on mac M1 in visual studio code. Can you please let me know  how did you launch this command:
    ``` arch -x86_64"?   

    ------------------------------
    Masoud Golalikhani
    ------------------------------



  • 5.  RE: CPLEX on macbook M1

    Posted Wed February 16, 2022 11:07 AM

    Hi! Hope you can help me. Where do I put this? In the terminal? I have the following in the terminal (which I opened normally in the folder of my file): 

      g++ -I/.../cplex/include -I/.../concert/include -L/.../cplex/lib/x86-64_osx/static_pic -L/.../concert/lib/x86-64_osx/static_pic ilodiet.cpp -lilocplex -lconcert



    ------------------------------
    Nathalia Wolf
    ------------------------------



  • 6.  RE: CPLEX on macbook M1

    Posted Wed February 16, 2022 11:25 AM
    We support only intel chip on Mac, not the M1 arm64 chip.
    So to make CPLEX work on your machine, you have to ask it to use the emulated intel mode via "arch -x86_64 make", "arch -x86_64 gcc" ...

    ------------------------------
    Vincent Beraudier
    ------------------------------



  • 7.  RE: CPLEX on macbook M1

    Posted Wed May 18, 2022 09:08 AM

    Thank you in advance for your kind support
    I installed the CPLEX academic version to solve a MIP model using Docplex in the VScode editor (using Python 3.10.4 64-bit). However, can't run it and getting the following error for this line: "from cplex import *":

    Exception has occurred: ImportError
    dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cplex/_internal/py310_cplex2210.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cplex/_internal/py310_cplex2210.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
      File "/Users/masoud/Desktop/Python-cplex/Pricing-h_g-w_pgijk-g2.py", line 8, in <module>
    

    Can you advise me to handle this problem?



    ------------------------------
    Masoud Golalikhani
    ------------------------------



  • 8.  RE: CPLEX on macbook M1

    Posted Tue May 24, 2022 11:44 AM

    I am also receiving a similar message when I try to import cplex into a python file. Any fixes for this? 

    ImportError: dlopen(/opt/homebrew/anaconda3/envs/school/lib/python3.10/site-packages/cplex-22.1.0.0-py3.10.egg/cplex/_internal/py310_cplex2210.so, 2): no suitable image found.  Did find:
    	/opt/homebrew/anaconda3/envs/school/lib/python3.10/site-packages/cplex-22.1.0.0-py3.10.egg/cplex/_internal/py310_cplex2210.so: mach-o, but wrong architecture
    	/opt/homebrew/anaconda3/envs/school/lib/python3.10/site-packages/cplex-22.1.0.0-py3.10.egg/cplex/_internal/py310_cplex2210.so: mach-o, but wrong architecture


    ------------------------------
    Avni Kothari
    ------------------------------