Could not locate Xpress

314 views
Skip to first unread message

Roland Vincze

unread,
May 18, 2016, 9:55:27 AM5/18/16
to Pyomo Forum
Hi!

Is the Xpress plugin fully functional? I read in an earlier post from 2014 it is not ready yet.
If yes, how is it locating the xpress executable/dll? I installed the student version from the official xpress site, but pyomo does not seem to find it:

WARNING: "[base]\site-packages\pyomo\solvers\plugins\solvers\XPRESS.py", 98, executable
Could not locate the 'optimizer' executable, which is required for solver xpress

Xpress created the following system variables:
CLASSPATH=%XPRESSDIR%\lib\xprs.jar;%XPRESSDIR%\lib\xprb.jar;%XPRESSDIR%\lib\xprm.jar;
INCLUDE
=%XPRESSDIR%\include;
LIB
=%XPRESSDIR%\lib;
XPRESSDIR
=C:\Programs\xpressmp
(The first three of these are not working, since the 'lib' directory is not present.)

Gabriel Hackebeil

unread,
May 18, 2016, 10:00:53 AM5/18/16
to pyomo...@googlegroups.com
--
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.

Roland Vincze

unread,
May 18, 2016, 10:05:28 AM5/18/16
to Pyomo Forum
Thanks for the quick reply!

Now, however, I get the SolverFactory's UnknownSolver error message:
RuntimeError: Attempting to use an unavailable solver.

The SolverFactory was unable to create the solver "amplxpress"
and returned an UnknownSolver object.  This error is raised at the point
where the UnknownSolver object was used as if it were valid (by calling
method "solve").

The original solver was created with the following parameters:
type: amplxpress
_args: ()
options: {}

Gabriel Hackebeil

unread,
May 18, 2016, 10:09:01 AM5/18/16
to pyomo...@googlegroups.com
That means you don’t have the amplxpress executable or it is not in your PATH. If it is not in the Xpress bin directory, it means it is probably a separate download.

Gabe

Roland Vincze

unread,
May 18, 2016, 10:17:46 AM5/18/16
to Pyomo Forum
Does Pyomo use an executable or dlls? I have only dll files in folder xpressmp\bin, and an IDE executable in folder xpressmp.

Gabriel Hackebeil

unread,
May 18, 2016, 10:19:24 AM5/18/16
to pyomo...@googlegroups.com
Pyomo uses executables. Some solvers like Cplex and Gurobi have a Python interface as well.

Gabe

Roland Vincze

unread,
May 18, 2016, 10:51:11 AM5/18/16
to Pyomo Forum
It looks like the student version does not have the functionality to connect it with Pyomo in any way.

However, I have an ampl package (ampl exec + solver exes and dlls) from my university, with university license. It has xpress.exe, I checked and the license is valid. The path of this folder is the first in the PATH variable. I still get the same errors as above, when trying to call "xpress" or "amplxpress" with SolverFactory.

Gabriel Hackebeil

unread,
May 18, 2016, 10:57:28 AM5/18/16
to pyomo...@googlegroups.com
We don’t have a functional solver plugin for the xpress executable, just amplxpress.

Gabe

Roland Vincze

unread,
May 18, 2016, 11:01:26 AM5/18/16
to Pyomo Forum
I see, but what actually is amplxpress? I can't find any info about it. If I have AMPL and a functioning xpress solver for it, I would assume I have amplxpress.

Gabriel Hackebeil

unread,
May 18, 2016, 11:12:16 AM5/18/16
to pyomo...@googlegroups.com
Good question. I have only seen it on a computer that belonged to someone else, and it was a linux machine. I had just assumed it came with Xpress, but maybe there is something we should be able to do with the DLLs on Windows. Any ideas? I don’t have much experience with this kind of thing on Windows.

Gabe

Gabriel Hackebeil

unread,
May 18, 2016, 11:18:23 AM5/18/16
to pyomo...@googlegroups.com
Does the xpress executable take a “-AMPL” option? It might be that they are the same executable in your version (or just on Windows). You can try something like the following:

model.write(“test.nl”)
os.system(“xpress test.nl -AMPL”)

Gabe

Roland Vincze

unread,
May 18, 2016, 11:25:21 AM5/18/16
to Pyomo Forum
Okay :D well, I am out of ideas, that's why I am writing here :)
But I actually need this only for a brief double-checking, since Gurobi gives me weird results. I have Knitro, too, and I was able to make it work. However, it does not make any logfile, which I would need. I searched but found only a tertiary logging option (0-console, 1-logfile, 2-both), but it does not make any logfile no matter what. I could not find an option for changing the logfile, either.

Edit: I just saw your answer. For that, xpress only gives the following answer:
XPRESS 28.01: xpress: jacdim: got M = 0, N = 0, NO = 0

Gabriel Hackebeil

unread,
May 18, 2016, 11:37:22 AM5/18/16
to pyomo...@googlegroups.com
Edit: I just saw your answer. For that, xpress only gives the following answer:
XPRESS 28.01: xpress: jacdim: got M = 0, N = 0, NO = 0


Well that means xpress is amplxpress, because that is ASL output. The following should work:

SolverFactory(“asl”, executable=“xpress”)

Let me know if it does not.

I’ll try to look into what is going on with Xpress on different systems when I find some time in the next month.

Gabe

Roland Vincze

unread,
May 18, 2016, 12:33:23 PM5/18/16
to Pyomo Forum
I get
WARNING: "[base]\site-packages\pyomo\solvers\plugins\solvers\ASL.py", 73, executable
No solver option specified for ASL solver interface
Traceback (most recent call last):
  File "C:\Users\Rolf\git\cvar\src\tests\Solvers.py", line 25, in <module>
    result = opt.solve(model)
  File "C:\Programs\Anaconda2\lib\site-packages\pyomo\opt\base\solvers.py", line 499, in solve
    self.available(exception_flag=True)
  File "C:\Programs\Anaconda2\lib\site-packages\pyomo\opt\solver\shellcmd.py", line 52, in available
    raise ApplicationError(msg % self.name)
pyutilib.common._exceptions.ApplicationError: No executable found for solver 'asl'
even if I put the full path "c:\...\xpress.exe". Strange thing is, it does not work with other solvers this way.

If we can't resolve this issue, could you please tell me how to make Knitro to write a log file?

Gabriel Hackebeil

unread,
May 18, 2016, 12:45:29 PM5/18/16
to pyomo...@googlegroups.com
Given the line numbers in that stack trace, it looks like you are on an older version of Pyomo that probably isn’t aware of the “executable” keyword. It will most likely work if you upgrade to the latest release. If you installed with pip, then you should be able to update by running

pip install -U Pyomo

Gabe

P.S. Knitro is another Frontline solver that is not easy to get a license to test with, so I can’t really provide much help there.

Roland Vincze

unread,
May 18, 2016, 1:02:17 PM5/18/16
to pyomo...@googlegroups.com
Whoa, it works! And the logging works, too. Thank you!

One small thing: after I updated pyomo, I get the following error every time if I run python or even conda (I'm using Anaconda2):
Error processing line 2 of C:\Programs\Anaconda2\lib\site-packages\Pyomo-4.3.11377-py2.7-nspkg.pth:

  Traceback (most recent call last):
    File "C:\Programs\Anaconda2\lib\site.py", line 152, in addpackage
      exec line
    File "<string>", line 1, in <module>
  KeyError: 'pyomo'

Remainder of file ignored

I have two rows in the .pth file mentioned above:
import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('pyomo',));ie = os.path.exists(os.path.join(p,'__init__.py'));m = not ie and sys.modules.setdefault('pyomo', types.ModuleType('pyomo'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('pyomo', 'data'));ie = os.path.exists(os.path.join(p,'__init__.py'));m = not ie and sys.modules.setdefault('pyomo.data', types.ModuleType('pyomo.data'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p);m and setattr(sys.modules['pyomo'], 'data', m)


If I comment out the second one, everything is working. Should I worry?


Gabriel Hackebeil

unread,
May 18, 2016, 1:07:19 PM5/18/16
to pyomo...@googlegroups.com
It looks like maybe you had previous installed Pyomo using the Windows installer. Otherwise, I don’t know why you would have any references to pyomo.data, etc. If might be best clean your installation of anything pyomo / pyutilib related by downloading pyomo_uninstall.py and then running

pip uninstall pyomo pyutilib
python pyomo_uninstall.py

Then reinstall pyomo using pip

pip install pyomo

Gabe

On May 18, 2016, at 10:02 AM, Roland Vincze <roli....@gmail.com> wrote:

Whoa, it works! And the logging works, too. Thank you!

One small thing: after I updated pyomo, I get the following error every time if I run python or even conda (I'm using Anaconda2):
Error processing line 2 of c:\programs\anaconda2\lib\site-packages\Pyomo-4.3.11377-py2.7-nspkg.pth:

  Traceback (most recent call last):
    File "c:\programs\anaconda2\lib\site.py", line 152, in addpackage
      exec line
    File "<string>", line 1, in <module>
  KeyError: 'pyomo'

Roland Vincze

unread,
May 18, 2016, 1:10:14 PM5/18/16
to pyomo...@googlegroups.com
Yes, I messed with pip and conda installs. I will try what you wrote. Thank you for all the help!

--
You received this message because you are subscribed to a topic in the Google Groups "Pyomo Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyomo-forum/DeC3NagRICc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyomo-forum...@googlegroups.com.

Gabriel Hackebeil

unread,
May 18, 2016, 1:11:07 PM5/18/16
to pyomo...@googlegroups.com
No problem.

Gabe
Reply all
Reply to author
Forward
0 new messages