ERROR: invalid literal for int() with base 10: 'c'

506 views
Skip to first unread message

Matt Anderson

unread,
Mar 25, 2016, 11:34:51 AM3/25/16
to Pyomo Forum


Hello,

I have installed pyomo on my linux machine. However, when I try to run even the simplest optimization program I am given the following error: "invalid literal for int() with base 10: 'c' "

I have attempted to look up the error and found many links for errors associated with Python. I have attempted to run the diet1.py with diet.dat test case available from the pyomo documentation. I have tried with both abstract and concrete models and the errors are the same. I don't believe that it is a solver problem as I have attempted to use the server option for the solver and have gotten the same result. An image of the normal output is attached below.

Thank you,

Matt



Gabriel Hackebeil

unread,
Mar 25, 2016, 11:52:12 AM3/25/16
to pyomo...@googlegroups.com
I can’t reproduce that error using the same example. Try running the pyomo command with “-c”. This will show a full traceback. This should help us track down the issue.

Gabe

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gang He

unread,
Apr 7, 2016, 3:37:09 PM4/7/16
to Pyomo Forum
I have the same problem, below is what I received with "-c":

WARNING: converting to the 'pyomo solve' subcommand

Traceback (most recent call last):

  File "/Users/ganghe/anaconda/bin/pyomo", line 11, in <module>

    sys.exit(main())

  File "/Users/ganghe/anaconda/lib/python3.5/site-packages/pyomo/scripting/pyomo_main.py", line 71, in main

    retval = ret[0].func(*ret)

  File "/Users/ganghe/anaconda/lib/python3.5/site-packages/pyomo/scripting/plugins/solve.py", line 199, in solve_exec

    val = pyomo.scripting.util.get_config_values(_options.model_or_config_file)

  File "/Users/ganghe/anaconda/lib/python3.5/site-packages/pyomo/scripting/util.py", line 1004, in get_config_values

    raise IOError("ERROR: Unexpected configuration file '%s'" % filename)

OSError: ERROR: Unexpected configuration file 'solve'


Not sure what caused this problem?

Gabe Hackebeil

unread,
Apr 7, 2016, 3:42:25 PM4/7/16
to pyomo...@googlegroups.com
This looks like a different problem. Can you provide the command that you executed?

Gabe

Gang He

unread,
Apr 7, 2016, 11:44:56 PM4/7/16
to Pyomo Forum
Thank you Gabe.

Below are the commands that I executed and the related error messages.

$ pyomo solve diet.py diet.dat --solver=glpk


[    0.00] Setting up Pyomo environment

[    0.00] Applying Pyomo preprocessing actions

[    0.00] Creating model

[    0.02] Applying solver

invalid literal for int() with base 10: 'c'

[    0.03] Pyomo Finished

ERROR: Unexpected exception while running model:

Error parsing solution data file, line 1


# With "-c"

$ pyomo -c solve diet.py diet.dat --solver=glpk


WARNING: converting to the 'pyomo solve' subcommand

Traceback (most recent call last):

  File "/Users/ganghe/anaconda/bin/pyomo", line 11, in <module>

    sys.exit(main())

  File "/Users/ganghe/anaconda/lib/python3.5/site-packages/pyomo/scripting/pyomo_main.py", line 71, in main

    retval = ret[0].func(*ret)

  File "/Users/ganghe/anaconda/lib/python3.5/site-packages/pyomo/scripting/plugins/solve.py", line 199, in solve_exec

    val = pyomo.scripting.util.get_config_values(_options.model_or_config_file)

  File "/Users/ganghe/anaconda/lib/python3.5/site-packages/pyomo/scripting/util.py", line 1004, in get_config_values

    raise IOError("ERROR: Unexpected configuration file '%s'" % filename)

OSError: ERROR: Unexpected configuration file 'solve'


Gabriel Hackebeil

unread,
Apr 8, 2016, 12:13:03 AM4/8/16
to pyomo...@googlegroups.com

$ pyomo -c solve diet.py diet.dat --solver=glpk

This is our mistake. If you had used -c after the “solve” it would have been interpreted as “--catch-errors” (although, at least to me, that sounds like opposite of what it does). Apparently, using it before “solve” means “--configuration-file”. We’re going to fix that confusing behavior.

Try using “-c” at the end of the command and report back.

Another thing to try is to completely uninstall Pyomo and start from the latest release (not yet announced, but uploaded to PyPy yesterday). Depending on how you installed you need to do either:

(1) run "pip uninstall Pyomo Pyutilib"

or 

(2) Download the pyomo_uninstall.py script and execute with whatever Python interpreter Pyomo has been installed into.

It probably doesn’t hurt to do both of these steps. Then, to install the latest release just run “pip install Pyomo Pyutilib”.

Gabe

rubic...@googlemail.com

unread,
Apr 18, 2016, 11:57:40 AM4/18/16
to Pyomo Forum
Since I get the same error, I am just gonna post my output here

pyomo solve -c --solver=glpk test_pyomo.py                                                                                   
[    0.00] Setting up Pyomo environment
[    0.00] Applying Pyomo preprocessing actions
[    0.00] Creating model
[    0.00] Applying solver

invalid literal for int() with base 10: 'c'
[    0.01] Pyomo Finished
ERROR: Unexpected exception (ValueError) while running model test_pyomo.py:

    Error parsing solution data file, line 1

Traceback (most recent call last):
  File "/usr/bin/pyomo", line 9, in <module>
    load_entry_point('Pyomo==4.3.11329', 'console_scripts', 'pyomo')()
  File "/usr/lib/python3.5/site-packages/pyomo/scripting/pyomo_main.py", line 83, in main
    retval = _options.func(_options, _unparsed)
  File "/usr/lib/python3.5/site-packages/pyomo/scripting/plugins/solve.py", line 214, in solve_exec
    name='pyomo solve')
  File "/usr/lib/python3.5/site-packages/pyutilib/workflow/task.py", line 109, in __call__
    self.execute()
  File "/usr/lib/python3.5/site-packages/pyomo/util/_task.py", line 160, in execute
    retval = self._fn(**self._kwds)
  File "/usr/lib/python3.5/site-packages/pyomo/scripting/util.py", line 931, in run_command
    retval = command(options=options, parser=parser)
  File "/usr/lib/python3.5/site-packages/pyomo/scripting/pyomo_command.py", line 349, in run_pyomo
    instance=model_data.instance)
  File "/usr/lib/python3.5/site-packages/pyutilib/workflow/task.py", line 109, in __call__
    self.execute()
  File "/usr/lib/python3.5/site-packages/pyomo/util/_task.py", line 163, in execute
    retval = self._fn(data, **self._kwds)
  File "/usr/lib/python3.5/site-packages/pyomo/scripting/util.py", line 588, in apply_optimizer
    results = solver_mngr.solve(instance, opt=opt, **keywords)
  File "/usr/lib/python3.5/site-packages/pyomo/opt/parallel/async_solver.py", line 33, in solve
    return self.execute(*args, **kwds)
  File "/usr/lib/python3.5/site-packages/pyomo/opt/parallel/manager.py", line 106, in execute
    ah = self.queue(*args, **kwds)
  File "/usr/lib/python3.5/site-packages/pyomo/opt/parallel/manager.py", line 121, in queue
    return self._perform_queue(ah, *args, **kwds)
  File "/usr/lib/python3.5/site-packages/pyomo/opt/parallel/local.py", line 58, in _perform_queue
    results = opt.solve(*args, **kwds)
  File "/usr/lib/python3.5/site-packages/pyomo/opt/base/solvers.py", line 580, in solve
    result = self._postsolve()
  File "/usr/lib/python3.5/site-packages/pyomo/opt/solver/shellcmd.py", line 267, in _postsolve
    results = self.process_output(self._rc)
  File "/usr/lib/python3.5/site-packages/pyomo/opt/solver/shellcmd.py", line 329, in process_output
    self.process_soln_file(results)
  File "/usr/lib/python3.5/site-packages/pyomo/solvers/plugins/solvers/GLPK.py", line 455, in process_soln_file
    raise ValueError(msg)

I got version 4.3.11329 from pip for python 3 and GLPK version 4.60 installed.
From what I can tell, this error stems from the fact, that the outputfile of GLPK prefixes lines with 'c' for comments and 'i' for the actual values

R

mchehreg

unread,
May 17, 2016, 1:42:37 PM5/17/16
to Pyomo Forum
This seems to have something to do with glpk v4.60. I got the same error message using glpk v460 and it was resolved when downgraded glpk to v4.55.

Similar issue reported here

-M

Christoph Molitor

unread,
May 19, 2016, 5:51:14 PM5/19/16
to Pyomo Forum
I can confirm that. I downgraded from 4.6 to 4.48 and now everything works.

Gang He

unread,
May 20, 2016, 12:10:45 AM5/20/16
to Pyomo Forum
Thank you all for the information. I did the downgrade and it fixed my problem, thanks!

To downgrade:
Go the folder where you save downloaded glpk-4.60
$ ./configure
$ sudo make uninstall

Then install a lower version.

Sebastián Alaggia

unread,
Jun 16, 2016, 10:29:38 AM6/16/16
to Pyomo Forum
I've tried with glpk 4.59 and 4.58 and is not working either. It works with 4.57

Gabriel Hackebeil

unread,
Jun 18, 2016, 6:11:20 AM6/18/16
to pyomo...@googlegroups.com
I believe Pyomo has been patched to work with Glpk 4.58+, but this hasn’t made it into a release yet. If you want to test the master branch of Pyomo trunk you can check it out from the GitHub page. This blog post also shows how you can install trunk using pip.

Gabe

Reply all
Reply to author
Forward
0 new messages