Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
  • 1.  Importing CPLEX12.5 into python problem

    Posted Sat April 04, 2015 02:01 AM

    Originally posted by: LouisL


    Hi guys, 

    I am new to this platform so bare with me if this is actually a dump question. I tried to install CPLEX12.5 onto my mac OS (Yosemite 10.10.2). Im using Python 2.7.6. During the installation, there is a minor problem that the available space cannot be detected. My friend told me I should raise a bug report for this but not sure where to do this. Can any one tell me where to report a bug ? This problem does not affect the installation process I suppose since I was able to complete the process and see that the CPLEX is in now on my computer. 

    The problem is when i trying to import CPLEX into Python. I followed the guidance in the manual. I use "python setup.py install" to install the package, which results in no error. However, in the python interpreter, when I type "import cplex", it shows the following message

    ======================================================================================================

    Python 2.7.6 (default, Sep  9 2014, 15:04:36) 

    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin

    Type "help", "copyright", "credits" or "license" for more information.

    >>> import cplex

    Traceback (most recent call last):

      File "<stdin>", line 1, in <module>

      File "/Library/Python/2.7/site-packages/cplex/__init__.py", line 43, in <module>

        import callbacks

      File "/Library/Python/2.7/site-packages/cplex/callbacks.py", line 48, in <module>

        from _internal._aux_functions import apply_freeform_two_args, apply_freeform_one_arg

      File "/Library/Python/2.7/site-packages/cplex/_internal/__init__.py", line 22, in <module>

        import _list_array_utils

      File "/Library/Python/2.7/site-packages/cplex/_internal/_list_array_utils.py", line 13, in <module>

        import _pycplex as CPX

      File "/Library/Python/2.7/site-packages/cplex/_internal/_pycplex.py", line 19, in <module>

        _pycplex_platform = swig_import_helper()

      File "/Library/Python/2.7/site-packages/cplex/_internal/_pycplex.py", line 15, in swig_import_helper

        _mod = imp.load_module('_pycplex_platform', fp, pathname, description)

      File "/Library/Python/2.7/site-packages/cplex/_internal/_pycplex_platform.py", line 23, in <module>

        from cplex._internal.py1013_cplex125 import *

    ImportError: dlopen(/Library/Python/2.7/site-packages/cplex/_internal/py1013_cplex125.so, 2): no suitable image found.  Did find:

    /Library/Python/2.7/site-packages/cplex/_internal/py1013_cplex125.so: mach-o, but wrong architecture

    ======================================================================================================

    I suspect it to be an 64bit and 32bit compatible problem. So I use "is_64bits = system.maxsize > 2**32" to double check. is_64bits is True in this case. Now I have no idea how to resolve this problem and does not know where to start digging. Can someone help me with this problem ? Thanks.

    Louis


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Importing CPLEX12.5 into python problem

    Posted Tue April 07, 2015 05:21 PM

    Indeed, in 12.5, only 32-bit Python is supported on Mac OS.  See the detailed system requirements here:

    http://www-01.ibm.com/support/docview.wss?uid=swg27019100

    After clicking on the link select the version "12.5" tab > "Mac OS" > "Supported Software" tab.

    I think you'll need to upgrade to at least 12.5.1.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Importing CPLEX12.5 into python problem

    Posted Tue April 07, 2015 05:36 PM

    Originally posted by: LouisL


    Guess I was misled by the operating system tab information. I thought supporting x86-64 architecture implies that it supports 64 bit python. If I already have 64bit python installed, is it possible that I install 32-bit version separately or add 32-bit support as a add-on or package to resolve this issue if update is not an option ?

     

    Thanks a lot btw :)

    Louis


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Importing CPLEX12.5 into python problem

    Posted Tue April 07, 2015 06:14 PM

    I don't have experience with this specific issue on Mac OS, but I did a bit of googling on things like "homebrew python 32 bit", and there appear to be many ways of doing this (e.g., installing a 32-bit python, or making the system python run in 32-bit mode).  Then again, this is not supported technically, so unless you want to experiment, I think you'll have to upgrade.  In case you don't know (this may or may not apply in your situation), you can get a free version of CPLEX through the academic initiative (see here).

     


    #CPLEXOptimizers
    #DecisionOptimization