Skip to main content

Failed to "import gurobipy" even after running setup.py or pysetup.bat

Comments

5 comments

  • Matthias Miltenberger
    Gurobi Staff Gurobi Staff

    How did you install Gurobi? Could you please share the commands you used and the resulting output?

    Cheers,
    Matthias

    0
  • A BC
    Gurobi-versary
    First Comment
    First Question

    I first run the .msi file, keeping every setting as default. Then, from the installation path, I ran python setup.py install, which returns:

    running install
    running build
    running build_py
    creating build
    creating build\lib
    creating build\lib\gurobipy
    copying python38\lib\gurobipy\__init__.py -> build\lib\gurobipy
    copying python38\lib\gurobipy\gurobipy.pyd -> build\lib\gurobipy
    running install_lib
    byte-compiling C:\Users\1\AppData\Local\Programs\Python\Python38\Lib\site-packages\gurobipy\__init__.py to __init__.cpython-38.pyc
    running install_egg_info
    Removing C:\Users\1\AppData\Local\Programs\Python\Python38\Lib\site-packages\gurobipy-9.0.1-py3.8.egg-info
    Writing C:\Users\1\AppData\Local\Programs\Python\Python38\Lib\site-packages\gurobipy-9.0.1-py3.8.egg-info
    removing C:\gurobi901\win64\build

     

    0
  • Matthias Miltenberger
    Gurobi Staff Gurobi Staff

    Could you please try using the Anaconda Python 3.8 distribution? This works fine with Gurobi. Apparently, there is some issue with the "official" Python 3.8 and Gurobi.

    Cheers,
    Matthias

    0
  • A BC
    Gurobi-versary
    First Comment
    First Question

    I downgraded python to 3.7.5 and it works too. Thanks.

    0
  • Sonali Suryawanshi
    Gurobi-versary
    First Comment

    I have installed gurobi 902 and python 3.8.3. 

    I had earlier used gurobi 811 and python 2.7.

     

    In both the above cases I uesd to get the DLL error.

     

    Solution:

    1. Open Anaconda promt as administrator

    2. go to gurobi/win directory, for example, cd gurobi902/win64

    3. type python setup.py install

     

    and you are free to use gurobi any where in your system.

     

    The only problem with this solution is you have to do it evrytime you start your system.

     

     

     

     

      

    0

Please sign in to leave a comment.