Commit c7cdea9
fix: use highsbox as fallback for HiGHS C API on Windows
highspy's _core.pyd on Windows does not export C symbols (only PyInit_*
is exported from a Windows DLL by default). On Linux/macOS the .so
exports all symbols so ffi.dlopen + Highs_create works fine; on Windows
it raises AttributeError.
Changes:
- After dlopen succeeds, probe Highs_create accessibility. If it fails
(Windows + highspy), automatically retry with highsbox's highs.dll.
- highsbox is added as a Windows-only optional dependency in [highs]:
highsbox>=1.9.0; sys_platform == 'win32'
so 'pip install mip[highs]' on Windows installs both highspy (Python
bindings) and highsbox (C API DLL), giving full HiGHS functionality.
- Hoist the highsbox path resolver to a module-level helper function
_get_highsbox_libfile() so it is reachable both at initial load and
at the fallback probe point.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 57f1881 commit c7cdea9
2 files changed
Lines changed: 41 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
17 | 35 | | |
18 | 36 | | |
19 | 37 | | |
| |||
25 | 43 | | |
26 | 44 | | |
27 | 45 | | |
28 | | - | |
| 46 | + | |
29 | 47 | | |
30 | 48 | | |
31 | 49 | | |
32 | 50 | | |
33 | 51 | | |
34 | 52 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
682 | 688 | | |
683 | 689 | | |
684 | 690 | | |
685 | | - | |
686 | | - | |
| 691 | + | |
| 692 | + | |
687 | 693 | | |
688 | 694 | | |
689 | 695 | | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
697 | 700 | | |
698 | | - | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
699 | 715 | | |
700 | 716 | | |
701 | 717 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
0 commit comments