Skip to main content

DLL load failed for gurobipy (Windows, calling python script from Matlab)

Answered

Comments

4 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Canqi,

    Are you able to execute the command

     > D:\anaconda\python.exe dualSP.py 

    from a terminal window without errors? If yes, then it looks like the path to the Gurobi \(\texttt{dll}\) is not set properly for MATLAB. You could try copying the dll to the current working directory of your MATLAB project.

    Best regards,
    Jaromił

    0
  • evan merkil
    Gurobi-versary
    First Comment

    To make it short, it means that you lacked some "dependencies" for the libraries you wanted to use. This is a common problem when installing python packages, mainly in windows. Before trying to use any kind of library, first it is suggested to look up whether it needs another library in python "family".

    The solution is to provide the python interpreter with the path-to-your-module/library. The simplest solution is to append that python path to your sys.path list. In your notebook, first try:

    import sys
    sys.path.append('my/path/to/module/folder')

    This isn't a permanent change in sys.path, because when you log out, your environment is reset, so any variables you may have set are lost.

    The better (and more permanent) way to solve this is to set your PYTHONPATH, which provides the interpreter with additional directories look in for python packages/modules.

    from BASH type: export PYTHONPATH=/path/to/new/folder:/another/path/...../ #each path must be separated by a colon

     

    0
  • Gana Riordi
    First Comment

    I have an issue when installing the gurobipy 11.0.2 version on Windows.

    I keep getting the error message:

    ImportError: DLL load failed while importing gurobipy: The specified procedure could not be found.

    I have followed the procedure on your Gurobi's website: https://support.gurobi.com/hc/en-us/articles/360044290292-How-do-I-install-Gurobi-for-Python

    Can you help fix this?
    I had never such issues in the last with the previous versions.
    0
  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Gana,

    Usually this can be fixed by creating a fresh virtual environment, activating it, then running

    pip install gurobipy==11.0.2

    - Riley

    0

Please sign in to leave a comment.