Decision Optimization

 View Only
  • 1.  Cplex python API in Jupyter

    Posted Mon August 17, 2020 03:52 AM
    I am trying to run cplex python example (facility.py) in Jupyter notebook. First I tried to import cplex in the Jupyter Notebook 
    from __future__ import print_function
    
    import sys
    
    import 
    from cplex.six.moves import range
    from inputdata import read_dat_file​
     I am getting this error below. 
    ---------------------------------------------------------------------------
    ModuleNotFoundError                       Traceback (most recent call last)
    <ipython-input-2-2446762ee40a> in <module>()
          4 
          5 import cplex
    ----> 6 from cplex.six.moves import range
          7 from inputdata import read_dat_file
    
    ModuleNotFoundError: No module named 'cplex.six​

    I tried to follow the instruction  below
    https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/Python_setup.html
    but my command prompt can't recognize the command  and getting this error
    C:\Program Files\IBM\ILOG\CPLEX_Studio129\cplex\python\3.7\x64_win64>Python setup.py install
    'Python' is not recognized as an internal or external command,
    operable program or batch file.​
    Any suggestion what is the best way to import cplex module to Jupyter notebook? 
    I am a cplex C++ API user. This settings is new to me. 
    Thanks 
    Roni

    ------------------------------
    Mohammad Roni
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Cplex python API in Jupyter

    Posted Mon August 17, 2020 04:01 AM
    This looks wrong to me:
    import 
    from cplex.six.moves import range​
    I think it should just read
    import cplex
    Then, if your system cannot find the python interpreter, you have to check your python installation. Make sure it is properly installed and the binary is on the PATH environment variable. Also maybe check the spelling. Maybe you have to specify as all lowercase.

    ------------------------------
    Daniel Junglas
    ------------------------------