Skip to main content

Solver (gurobi) returned non-zero return code (1)

Answered

Comments

9 comments

  • Matthias Miltenberger
    • Gurobi Staff Gurobi Staff

    Hi Matteo,

    The error message reads

    Unable to open file 'C:\Users\matte\Desktop\università\
    POLITO\Secondo anno\Models and scenarios\Project\Location\
    Temoa-energysystem\data_files\debug_logs\lp_files\tmp6yoz6g3y.pyomo.lp'
    for input

    So you need to check whether this file actually exists and whether this is really the correct file to read. It does appear to be some temporary file so it might have been already deleted.

    Cheers,
    Matthias

    0
  • Dávid Markovics
    • Gurobi-versary
    • First Comment

    Dear Matthias,

    I have the same issue, the file exist in the given folder, but somehow it gives this error. Do you have any idea, what could be the problem and how to solve it?

    Thanks,

    Dávid

    0
  • Matthias Miltenberger
    • Gurobi Staff Gurobi Staff

    Hi Dávid,

    Please make sure that the file path does not contain any non-ASCII characters - this can easily lead to errors when trying to parse the path. I know, it's 2022 and we should expect a wide coverage of unicode functionality across different tools and systems, but it's still best to just avoid any "weird" characters in your path.

    If this does not fix the issue, you should provide us with some more information on the error.

    Cheers,
    Matthias

    0
  • Dávid Markovics
    • Gurobi-versary
    • First Comment

    Hi,

    Thank you, that was the problem in my case.

    Unfortunately for educational Onedrive it's default that the virtual drive contains the characters of the  university's (local) name. This causes problems sometimes :/

    Bests,

    Dávid

     

    0
  • Laura Kaiser
    • Gurobi-versary
    • First Comment

    Hi all, 

    I have a similar problem and my file path doesn't contain non-ASCII characters.

    The error I get:

    (urbs) laurakaiser@Lauras-MacBook-Air Final % python run_single_year.py

    Added a global Cost budget for the entire period with the value: inf.

    Added a global CO2 budget for the entire period with the value: inf.

    Set parameter Username

    Academic license - for non-commercial use only - expires 2023-06-08

    Error reading LP format file /var/folders/hn/txy1k3nx6w9_0zfsb13cz09m0000gn/T/tmp0p5cveg7.pyomo.lp at line 6074519

    Unrecognized constraint RHS or sense

    Neighboring tokens: " <= nan c_u_x2873316_: -1 x249251 +1 x249741 "

     

    Traceback (most recent call last):

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

      File "/Users/laurakaiser/opt/anaconda3/envs/urbs/lib/python3.6/site-packages/pyomo/solvers/plugins/solvers/GUROBI_RUN.py", line 61, in gurobi_run

        model = read(model_file)

      File "src/gurobipy/gurobi.pxi", line 3575, in gurobipy.read

      File "src/gurobipy/gurobi.pxi", line 90, in gurobipy.gurobi.read

    gurobipy.GurobiError: Unable to read model

    Unable to read file

    ERROR: Solver (gurobi) returned non-zero return code (1)

    ERROR: See the solver log above for diagnostic information.

    Traceback (most recent call last):

      File "run_single_year.py", line 142, in <module>

        report_sites_name=report_sites_name)

      File "/Users/laurakaiser/Desktop/Master Thesis/Modeling/2050/Final/urbs/runfunctions.py", line 105, in run_scenario

        result = optim.solve(prob, tee=True)

      File "/Users/laurakaiser/opt/anaconda3/envs/urbs/lib/python3.6/site-packages/pyomo/opt/base/solvers.py", line 600, in solve

        "Solver (%s) did not exit normally" % self.name)

    pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally

    0
  • Jiayin Fu
    • Gurobi-versary
    • First Comment
    • First Question

    Hi Laura,

    I have the same issue. Do you have any ideas solving this problem? Thank you.

     

    Best,

    Jiayin Fu

    0
  • Jaromił Najman
    • Gurobi Staff Gurobi Staff

    The issue here is that the model file holds some nan and inf values.

    This is indicated by the messages

    Added a global Cost budget for the entire period with the value: inf.

    Added a global CO2 budget for the entire period with the value: inf.

    and

    nrecognized constraint RHS or sense

    Neighboring tokens: " <= nan c_u_x2873316_: -1 x249251 +1 x249741 "

    You can see the nan on the RHS of the constraint.

    0
  • Jiayin Fu
    • Gurobi-versary
    • First Comment
    • First Question

    Hi Jaromił,

    I found my error message doesn't contain any info about nan or inf values, yet I got very much alike errors here:

    E:\Anaconda\envs\envINEEDaggregate\python.exe E:/Git/InEEd-DC/ineed-dc-framework/runme.py
    Traceback (most recent call last):
      File "E:/Git/InEEd-DC/ineed-dc-framework/runme.py", line 66, in <module>
        prosumers[prosumer_name] = process_each_prosumer(prosumer_name, prosumer_dict[prosumer_name], input_profiles, t_start, t_horizon, t_step, prosumer_strategy)
      File "E:/Git/InEEd-DC/ineed-dc-framework/runme.py", line 14, in process_each_prosumer
        prosumer.run_optimization(prosumer_strategy)
      File "E:\Git\InEEd-DC\ineed-dc-framework\Model_Library\Prosumer\main.py", line 62, in run_optimization
        self.prosumer.run_optimization(ps_strategy)
      File "E:\Git\InEEd-DC\ineed-dc-framework\Model_Library\Prosumer\model\BaseProsumer.py", line 396, in run_optimization
        self._solver_result = solver.solve(self._model, tee=False)
      File "E:\Anaconda\envs\envINEEDaggregate\lib\site-packages\pyomo\opt\base\solvers.py", line 600, in solve
        "Solver (%s) did not exit normally" % self.name)
    pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
    ERROR: Solver (gurobi) returned non-zero return code (1)
    ERROR: Solver log: Traceback (most recent call last):
          File "extern.pxi", line 19, in gurobipy.__bytestostring
        UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb8 in position 22:
        invalid start byte Exception ignored in: 'gurobipy.logcallbackstub'
        Traceback (most recent call last):
          File "extern.pxi", line 19, in gurobipy.__bytestostring
        UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb8 in position 22:
        invalid start byte Traceback (most recent call last):
          File "<stdin>", line 5, in <module> File
          "E:\Anaconda\envs\envINEEDaggregate\lib\site-
          packages\pyomo\solvers\plugins\solvers\GUROBI_RUN.py", line 61, in
          gurobi_run
            model = read(model_file)
          File "gurobi.pxi", line 3198, in gurobipy.read File "gurobi.pxi", line
          80, in gurobipy.gurobi.read File "gurobi.pxi", line 32, in
          gurobipy.gurobi._getdefaultenv File "env.pxi", line 67, in
          gurobipy.Env.__init__ File "exception.pxi", line 20, in
          gurobipy.GurobiError.__init__ File "extern.pxi", line 19, in
          gurobipy.__bytestostring
        UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb8 in position 39:
        invalid start byte

    Process finished with exit code 1

    I'm sure there's no non-ascii chars in the paths. Could you tell me a clue about how to solve it? Thank you so  much.

    Best, 

    Jiayin

    0
  • Jaromił Najman
    • Gurobi Staff Gurobi Staff

    Hi Jiayin,

    It looks like you have non-standard characters in your executable python code

    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb8 in position 39:
        invalid start byte

    This looks like a Python specific issue. One discussion on this issue can be found in this GH item.

    Best regards, 
    Jaromił

    0

Please sign in to leave a comment.