Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  does is possible to compile a code using cplex with pypy?

    Posted 11/26/15 04:16 PM

    Originally posted by: NellyMonserrat


    Hi everybody. 

     

    I've heard  that pypy is a fast, compilant alternative implementation of python languaje, since I have a model coding in python, I'm trying to use it, but I have problems linking it to cplex. Does anyone have idea of how do it? Cplex is already link with python, so, when I run the program with just python, everything is ok, but when I try to used pypy I get this error: ImportError: No module named cplex.

     

    Thanks in advantage!

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: does is possible to compile a code using cplex with pypy?

    Posted 11/27/15 12:53 AM

    The most likely reason for this error is that cplex is not in your PYTHONPATH. Try setting your PYTHONPATH variable so that it points to the cplex/python/2.6/x86-64_linux (adjust to your python version and OS type) directory in your CPLEX installation. You need to set the PYTHONPATH variable before you start python.

    I am not an expert in this but from the pypy website it is not immediately clear to me whether this is going to work or not. The CPLEX Python module uses native code and I don't know whether the native code interface in pypy is the same as for cpython.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: does is possible to compile a code using cplex with pypy?

    Posted 11/28/15 06:02 PM

    Originally posted by: NellyMonserrat


    Hi Daniel, thanks so much for replying. I still have the problem, even though cplex is already in the path. Look:

     

    >>>>sys.path
    ['', '/usr/lib/pypy/lib_pypy/__extensions__', '/usr/lib/pypy/lib_pypy', '/usr/lib/pypy/lib-python/2.7', '/usr/lib/pypy/lib-python/2.7/lib-tk', '/usr/lib/pypy/lib-python/2.7/plat-linux2', '/usr/local/lib/pypy2.7/dist-packages', '/usr/lib/pypy/dist-packages', '/usr/lib/pypy/dist-packages/cplex/lib/python/cplex']
    >>>> 

     

    When I import cplex, I get this message:

     

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "cplex/__init__.py", line 43, in <module>
        import callbacks
      File "cplex/callbacks.py", line 48, in <module>
        from _internal._aux_functions import apply_freeform_two_args, apply_freeform_one_arg
      File "cplex/_internal/__init__.py", line 22, in <module>
        import _list_array_utils
      File "cplex/_internal/_list_array_utils.py", line 13, in <module>
        import _pycplex as CPX
      File "cplex/_internal/_pycplex.py", line 19, in <module>
        _pycplex_platform = swig_import_helper()
      File "cplex/_internal/_pycplex.py", line 15, in swig_import_helper
        _mod = imp.load_module('_pycplex_platform', fp, pathname, description)
      File "cplex/_internal/_pycplex_platform.py", line 39, in <module>
        from cplex._internal.py1013_cplex1251 import *
    ImportError: No module named cplex._internal.py1013_cplex1251


     

    Could you please help me? :(

     

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: does is possible to compile a code using cplex with pypy?

    Posted 11/30/15 11:36 AM

    @NellyMonserrat fd38d32e-d2c9-4593-9089-ceaa4357511f​, no, the CPLEX Python API will not work with PyPy.  The ImportError you're getting is triggered because PyPy is not able to load the shared library (py1013_cplex1251.so).  As indicated on the PyPy compatibility page, "C extensions need to be recompiled for PyPy in order to work."  This is not currently supported.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: does is possible to compile a code using cplex with pypy?

    Posted 11/30/15 06:24 PM

    Originally posted by: NellyMonserrat


    Hi, thanks so much for your help. Now I can stop trying this works .


    #CPLEXOptimizers
    #DecisionOptimization