Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HiGHS solver fails as LegacySolver is not available #2774

Closed
SolverMax opened this issue Mar 20, 2023 · 16 comments
Closed

HiGHS solver fails as LegacySolver is not available #2774

SolverMax opened this issue Mar 20, 2023 · 16 comments

Comments

@SolverMax
Copy link

Summary

Calling the solver appsi_highs produces the error message:
ApplicationError: Solver <class 'pyomo.contrib.appsi.base.SolverFactoryClass.register..decorator..LegacySolver'> is not available (NotFound).

Steps to reproduce the issue

Sample model at:
https://github.com/SolverMax/Random/tree/main/HiGHS-testing/Case-001

The sample model runs correctly when called using the cbc solver (specified in the data file), but fails when using appsi_highs. A few weeks ago it ran correctly with appsi_highs, but Pyomo and HiGHS versions have been upgraded since then.

Information on your system

Pyomo version: Pyomo 6.5.0 (CPython 3.9.7 on Windows 10)
Python version: 3.9.7
How Pyomo was installed (PyPI, conda, source): PyPI
Solver (if applicable): HiGHs v1.5.1

@michaelbynum
Copy link
Contributor

How did you install HiGHS? Did you install the python bindings as well? It does not look like highspy 1.5.1 is on PyPI yet, so we are not testing against it yet. I did install the latest version of HiGHS locally, and everything seems to be working.

@SolverMax
Copy link
Author

SolverMax commented Mar 21, 2023

HiGHS was originally installed using:
pip install highspy
It was recently upgraded using:
pip install highspy --upgrade
Testing the solvers using:
pyomo help --solvers
used to indicate appsi_highs was available by marking it with a + but it no longer does.
The HiGHS version says 1.5.0.dev0 I'm not sure why I thought it was 1.5.1

@michaelbynum
Copy link
Contributor

Can you try:

>>> import highspy

in a python console?

@SolverMax
Copy link
Author

SolverMax commented Mar 21, 2023

After downgrading to 1.4.0dev I get this:
import highspy
highspy
<module 'highspy' from 'D:\OneDrive\Python\blog\lib\site-packages\highspy\init.py'>

After reinstalling 1.5.0dev I get this:
import highspy
Traceback (most recent call last):
File "", line 1, in
File "D:\OneDrive\Python\blog\lib\site-packages\highspy_init_.py", line 30, in
from .highs import (
File "D:\OneDrive\Python\blog\lib\site-packages\highspy\highs.py", line 1, in
from .highs_bindings import (
ImportError: DLL load failed while importing highs_bindings: The specified procedure could not be found.

@michaelbynum
Copy link
Contributor

If you look in the highspy directory in your python site-packages, do you see any dll files?

@SolverMax
Copy link
Author

No DLLs

@michaelbynum
Copy link
Contributor

Sounds like the DLL is not getting copied from the wheel into your site-packages. I'll create an issue on the HiGHS repo. In the meantime, you can probably manually download the correct wheel from here (https://pypi.org/project/highspy/#files), unzip the wheel, and put the DLL in your site packages.

@michaelbynum
Copy link
Contributor

Sorry - can you check one more thing? Are there any ".pyd" files in your site-packages?

@michaelbynum
Copy link
Contributor

I think you need the ".pyd" rather than the DLL. I'm not sure though.

@SolverMax
Copy link
Author

I have .\Lib\site-packages\highspy\highs_bindings.cp39-win_amd64.pyd
Looking around I also have .\Lib\site-packages\highspy.libs\msvcp140.dll

These appear to be the same filenames that v1.4.0dev has.

@michaelbynum
Copy link
Contributor

Strange...

@michaelbynum
Copy link
Contributor

It looks like there is also a highs-*.dll in the wheel under highspy.libs. Do you see anything like that?

@SolverMax
Copy link
Author

Yes, that's there too, along with .load-order-highspy-1.5.0.dev0

@michaelbynum
Copy link
Contributor

Then I am stumped.

@SolverMax
Copy link
Author

When I downgrade to 1.4.0dev my test model solves OK, but not with 1.5.0dev. I'll continuing using 1.4.0dev in the meantime.

@jsiirola
Copy link
Member

Given that this has been quiet for a year and a half (this sounds like an issue with the 1.5.0dev release and HiGHS is now up to 1.8.1; plus #3449 fixes some issues in the Pyomo HiGHS interface), I am going to close this.

@SolverMax, if you are still seeing problems with the HiGHS distribution, please open a new issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants