--
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.
from pyomo.environ import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pyomo/environ/__init__.py", line 76, in <module>
import_packages()
File "/usr/local/lib/python2.7/dist-packages/pyomo/environ/__init__.py", line 73, in import_packages
pkg.load()
File "/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/__init__.py", line 13, in load
import pyomo.solvers.plugins.solvers
File "/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/solvers/__init__.py", line 16, in <module>
import pyomo.solvers.plugins.solvers.glpk_direct
File "/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/solvers/glpk_direct.py", line 21, in <module>
from glpk import *
File "/usr/lib/python2.7/dist-packages/glpk/__init__.py", line 26, in <module>
from glpk_parser import *
File "/usr/lib/python2.7/dist-packages/glpk/glpk_parser.py", line 352, in <module>
yacc.yacc(write_tables=0, debug=0)
File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 3244, in yacc
read_signature = lr.read_table(tabmodule)
File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 1967, in read_table
if parsetab._tabversion != __tabversion__:
AttributeError: 'module' object has no attribute '_tabversion'lucas@lucas-K55VD:~$ sudo pip install pyomo
The directory '/home/lucas/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The directory '/home/lucas/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): pyomo in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): ply in /usr/local/lib/python2.7/dist-packages (from pyomo)
Requirement already satisfied (use --upgrade to upgrade): nose in /usr/local/lib/python2.7/dist-packages (from pyomo)
Requirement already satisfied (use --upgrade to upgrade): PyUtilib==5.1.3556 in /usr/local/lib/python2.7/dist-packages (from pyomo)
Requirement already satisfied (use --upgrade to upgrade): six>=1.6.1 in /usr/local/lib/python2.7/dist-packages (from pyomo)
lucas@lucas-K55VD:~$ pyomo --version
Traceback (most recent call last):
File "/usr/local/bin/pyomo", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/pyomo/scripting/pyomo_main.py", line 33, in main
import pyomo.environ
File "/usr/local/lib/python2.7/dist-packages/pyomo/environ/__init__.py", line 76, in <module>
import_packages()
File "/usr/local/lib/python2.7/dist-packages/pyomo/environ/__init__.py", line 73, in import_packages
pkg.load()
File "/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/__init__.py", line 13, in load
import pyomo.solvers.plugins.solvers
File "/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/solvers/__init__.py", line 16, in <module>
import pyomo.solvers.plugins.solvers.glpk_direct
File "/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/solvers/glpk_direct.py", line 21, in <module>
from glpk import *
File "/usr/lib/python2.7/dist-packages/glpk/__init__.py", line 26, in <module>
from glpk_parser import *
File "/usr/lib/python2.7/dist-packages/glpk/glpk_parser.py", line 352, in <module>
yacc.yacc(write_tables=0, debug=0)
File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 3244, in yacc
read_signature = lr.read_table(tabmodule)
File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 1967, in read_table
if parsetab._tabversion != __tabversion__:
AttributeError: 'module' object has no attribute '_tabversion'
lucas@lucas-K55VD:~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.The exception is being thrown by the GLPK python package, and is not a strictly Pyomo error. I have updated Pyomo trunk so that exceptions thrown by GLPK are not fatal to Pyomo.
Suggestions:
- upgrade your GLPK package (pip install –upgrade glpk) [this may or may not fix the problem, depending on if GLPK has fixed their bug]
- remove your GLPK python package (pip uninstall glpk)
- find pyomo/solvers/plugins/solvers/glpk_direct.py, and edit line #21 to comment out “from glpk import *”
john
From: pyomo...@googlegroups.com [mailto:pyomo...@googlegroups.com]
Sent: Monday, August 24, 2015 8:03 AM
To: Pyomo Forum
Cc: dlwoo...@ucdavis.edu
Subject: Re: [EXTERNAL] Re: Python editors and pyomo
I was using spyder. This is Ubuntu terminal:
lucas@lucas-K55VD:~$
sudo pip install pyomo
The directory
'/home/lucas/.cache/pip/http'
or its parent directory
is
not owned
by the current user
and the cache has been
disabled.
Please check the permissions
and owner of that directory.
If executing pip
with sudo,
you may want sudo's -H flag.
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install
--upgrade pip'
command.
The directory '/home/lucas/.cache/pip/http'
or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's
-H flag.
Requirement already satisfied
(use
--upgrade to upgrade):
pyomo in
/usr/local/lib/python2.7/dist-packages
Requirement already satisfied
(use
--upgrade to upgrade):
ply in
/usr/local/lib/python2.7/dist-packages
(from
pyomo)
Requirement already satisfied
(use
--upgrade to upgrade):
nose in
/usr/local/lib/python2.7/dist-packages
(from
pyomo)
Requirement already satisfied
(use
--upgrade to upgrade):
PyUtilib==5.1.3556
in
/usr/local/lib/python2.7/dist-packages
(from
pyomo)
Requirement already satisfied
(use
--upgrade to upgrade):
six>=1.6.1
in
/usr/local/lib/python2.7/dist-packages
(from
pyomo)
lucas@lucas-K55VD:~$
python
Python
2.7.6
(default,
Jun
22
2015,
17:58:13)
[GCC
4.8.2]
on linux2
Type
"help",
"copyright",
"credits"
or
"license"
for more information.
>>> exit()
lucas@lucas-K55VD:~$
sudo pip install pyomo
The directory
'/home/lucas/.cache/pip/http'
or its parent directory
is
not owned
by the current user
and the cache has been
disabled.
Please check the permissions
and owner of that directory.
If executing pip
with sudo,
you may want sudo's -H flag.
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install
--upgrade pip'
command.
The directory '/home/lucas/.cache/pip/http'
or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's
-H flag.
Requirement already satisfied
(use
--upgrade to upgrade):
pyomo in
/usr/local/lib/python2.7/dist-packages
Requirement already satisfied
(use
--upgrade to upgrade):
ply in
/usr/local/lib/python2.7/dist-packages
(from
pyomo)
Requirement already satisfied
(use
--upgrade to upgrade):
nose in
/usr/local/lib/python2.7/dist-packages
(from
pyomo)
Requirement already satisfied
(use
--upgrade to upgrade):
PyUtilib==5.1.3556
in
/usr/local/lib/python2.7/dist-packages
(from
pyomo)
Requirement already satisfied
(use
--upgrade to upgrade):
six>=1.6.1
in
/usr/local/lib/python2.7/dist-packages
(from
pyomo)
lucas@lucas-K55VD:~$
pyomo --version
Traceback (most recent call last):
File
"/usr/local/bin/pyomo",
line 11,
in
<module>
sys.exit(main())
File
"/usr/local/lib/python2.7/dist-packages/pyomo/scripting/pyomo_main.py",
line 33,
in main
import
pyomo.environ
File
"/usr/local/lib/python2.7/dist-packages/pyomo/environ/__init__.py",
line 76,
in
<module>
import_packages()
File
"/usr/local/lib/python2.7/dist-packages/pyomo/environ/__init__.py",
line 73,
in import_packages
pkg.load()
File
"/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/__init__.py",
line 13,
in load
import
pyomo.solvers.plugins.solvers
File
"/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/solvers/__init__.py",
line 16,
in
<module>
import
pyomo.solvers.plugins.solvers.glpk_direct
File
"/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/solvers/glpk_direct.py",
line 21,
in
<module>
from
glpk import
*
File
"/usr/lib/python2.7/dist-packages/glpk/__init__.py",
line 26,
in
<module>
from
glpk_parser import
*
File
"/usr/lib/python2.7/dist-packages/glpk/glpk_parser.py",
line 352,
in
<module>
yacc.yacc(write_tables=0,
debug=0)
File
"/usr/local/lib/python2.7/dist-packages/ply/yacc.py",
line 3244,
in yacc
read_signature =
lr.read_table(tabmodule)
File
"/usr/local/lib/python2.7/dist-packages/ply/yacc.py",
line 1967,
in read_table
if
parsetab._tabversion
!= __tabversion__:
AttributeError:
'module'
object has
no attribute
'_tabversion'
lucas@lucas-K55VD:~$
python
Python
2.7.6
(default,
Jun
22
2015,
17:58:13)
[GCC
4.8.2]
on linux2
Type
"help",
"copyright",
"credits"
or
"license"
for more information.
My read is that that exception is due to the GLPK python bindings, so they would be in the best position to fix it.
That said, Pyomo only invoked the GLPK python bindings through the GLPKDirect interface. That interface was always somewhat experimental. We ended up disabling it in Dec 2013: the code was not being actively tested in any of our test suites and no users appeared to be using it. My recent commit to trunk prevents Pyomo from even attempting to import GLPK, which should isolate Pyomo from any further issues in the GLPK python bindings.
John
From: pyomo...@googlegroups.com [mailto:pyomo...@googlegroups.com]
Sent: Monday, August 24, 2015 1:04 PM
To: Pyomo Forum
Subject: Re: [EXTERNAL] Re: Python editors and pyomo
The problem is glpk, do we need to contact the GNU project?
--
I am not entirely sure what you are asking… we have several interfaces for GLPK, CBC, Gurobi, and CPLEX that are part of the core Pyomo distribution and are tested daily. Are you trying to interface with those solvers, or with a different solver?
john
From: pyomo...@googlegroups.com [mailto:pyomo...@googlegroups.com]
Sent: Tuesday, August 25, 2015 1:34 PM
To: Pyomo Forum
Subject: Re: [EXTERNAL] Re: Python editors and pyomo
Continuing on the solver topic, can I get another MIP solver, beside GLPK to work with Pyomo?
The only problem were the glpk python bindings, so you should only have had to uninstall the glpk python module (with pip uninstall glpk). You should not have had to uninstall all of GLPK. There are no known problems with GLPK binaries (and we regularly test against it).
If you are looking for another open source solver, I would start with either CBC (from COIN-OR) or SCIP (from ZIB). Both are supported in Pyomo.
If you choose to use a different solver, you need to instantiate a different solver (somewhere in your script you probably have a line similar to “opt = SolverFactory(‘glpk’)” that needs to be changed).
john
From: pyomo...@googlegroups.com [mailto:pyomo...@googlegroups.com]
Sent: Tuesday, August 25, 2015 2:33 PM
To: Pyomo Forum
Subject: Re: [EXTERNAL] Re: Python editors and pyomo
You said to uninstall GLPK and that is what I did:
--
sudo apt-get install python-glpk
sudo apt-get install glpk-utilsCould not locate the 'cbc' executable, which is required for solver cbc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 685, in runfile
execfile(filename, namespace)
File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 78, in execfile
builtins.execfile(filename, *where)
File "/home/lucas/Assembly line/Askin_Standridge/costfunction.py", line 18, in <module>
nstaz=nst(TC)
File "line_balancing.py", line 78, in nst
results = opt.solve( instance )
File "/usr/local/lib/python2.7/dist-packages/pyomo/opt/base/solvers.py", line 432, in solve
self.available(exception_flag=True)
File "/usr/local/lib/python2.7/dist-packages/pyomo/opt/solver/shellcmd.py", line 52, in available
raise ApplicationError(msg % self.name)
pyutilib.common._exceptions.ApplicationError: No executable found for solver 'cbc'
>>> from pyomo.environ import SolverFactory
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pyomo/environ/__init__.py", line 76, in <module>
import_packages()
File "/usr/local/lib/python2.7/dist-packages/pyomo/environ/__init__.py", line 73, in import_packages
pkg.load()
File "/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/__init__.py", line 13, in load
import pyomo.solvers.plugins.solvers
File "/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/solvers/__init__.py", line 16, in <module>
import pyomo.solvers.plugins.solvers.glpk_direct
File "/usr/local/lib/python2.7/dist-packages/pyomo/solvers/plugins/solvers/glpk_direct.py", line 21, in <module>
from glpk import *
File "/usr/lib/python2.7/dist-packages/glpk/__init__.py", line 26, in <module>
from glpk_parser import *
File "/usr/lib/python2.7/dist-packages/glpk/glpk_parser.py", line 352, in <module>
yacc.yacc(write_tables=0, debug=0)
File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 3244, in yacc
read_signature = lr.read_table(tabmodule)
File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 1967, in read_table
if parsetab._tabversion != __tabversion__:
AttributeError: 'module' object has no attribute '_tabversion'lucas@lucas-K55VD:/usr/local/lib/python2.7/dist-packages/pyomo/core/tests/examples$ pyomo --solver=cbc pmedian4.py
WARNING: converting to the 'pyomo solve' subcommand
[ 0.00] Setting up Pyomo environment
[ 0.00] Applying Pyomo preprocessing actions
[ 0.00] Creating model
[ 0.00] Applying solver
WARNING: "[base]/dist-packages/pyomo/solvers/plugins/solvers/CBCplugin.py", 180, executable
Could not locate the 'cbc' executable, which is required for solver cbc
[ 0.00] Pyomo Finished
ERROR: Unexpected exception while running model:
No executable found for solver 'cbc'
For some reason I don't understand glpk is working now, but not cbc....
--
sudo apt-get install coinor-cbc