HiGHS: ImportError for `highspy`
Hello, I’m on an M1 Mac (MacOS Ventura, Python 3.10.9) and downloaded HiGHS via PyPI (highspy
) and am getting this import error.
I didn’t seen any similar issues asked previously, so I figured I’d ask here. Appreciate any help!
Python 3.10.9 (main, Jan 11 2023, 09:18:20) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import highspy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/e3-work/opt/anaconda3/envs/nmt-pins/lib/python3.10/site-packages/highspy/__init__.py", line 1, in <module>
from .highs import (
File "/Users/e3-work/opt/anaconda3/envs/nmt-pins/lib/python3.10/site-packages/highspy/highs.py", line 1, in <module>
from .highs_bindings import (
ImportError: dlopen(/Users/e3-work/opt/anaconda3/envs/nmt-pins/lib/python3.10/site-packages/highspy/highs_bindings.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '__ZN5Highs10clearModelEv'
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 30 (17 by maintainers)
Hi @alspadoni, this actually is with high priority. I can not give you an exact time, but we expect to have it resolved sooner rather than later.
@goroderickgo You will need to compile and install manually
I installed via
pip
and obtained the same error:I am on Intel macOS 13.
For me the following did the trick:
We’ll publish this as soon as the process is fixed for all architectures. It’s a major priority
@ZedongPeng I think they changed the directory structure.
Try
pip install ..
There will be a new pip release soon, but we can not say exact timing. We need to finish some features we are currently implementing and some features we are adding to the python interface.
Hi,
I have the same error:
ImportError: dlopen(…opt/anaconda3/envs/test/lib/python3.9/site-packages/highspy/highs_bindings.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace ‘__ZN5Highs10clearModelEv’
I’m using Apple M2 chip and installed highspy using pip.
We intend to keep track of such changes but at a later stage, once we have finished implementing some features.
Sorry, I don’t know when this was fixed. Keeping track of such changes is too time-consuming for us.
Just as an FYI, this problem isn’t present (for me at least) on the master branch if I compile from source - can you point me to the commit that fixed this issue on the ‘latest’ branch?
Also apologies if this is available somewhere, but what changed in the 1.5.3 release? There’s no source files on pip and I don’t see a version here on GitHub.
MacOS will use Clang to compile C++ sources, so we can use
llvm-cxxfilt
to find out exactly what it’s complaining about:Looks like the library on PyPI either didn’t compile Highs.cpp (unlikely) or something is not linked correctly (more likely) – might be due to how conda is handling this wheel? Try installing with pip to see if that resolves it.
If it doesn’t, as a hacky workaround, try adding the path to libhighs:
sys.path.append("/Users/e3-work/opt/anaconda3/envs/nmt-pins/lib/python3.10/site-packages/highspy/.dylibs/")
(also make sure there is indeed a library namedlibhighs.1.5.0.dylib
somewhere in/Users/e3-work/opt/anaconda3/envs/nmt-pins/lib/python3.10/site-packages/highspy
)