-
Notifications
You must be signed in to change notification settings - Fork 89
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
Trying to link mip to Debian's CBC package throws undefined error #165
Comments
Hi,
I think that Debian probably includes the last stable (API stable) version of CBC.
Python-MIP requires the development version of CBC.
From: sjferc <notifications@github.com>
Reply-To: coin-or/python-mip <reply@reply.github.com>
Date: Monday, November 30, 2020 at 6:38 AM
To: coin-or/python-mip <python-mip@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: [coin-or/python-mip] Trying to link mip to Debian's CBC package throws undefined error (#165)
I installed coinor-cbc to my armhf system, and did this:
export PMIP_CBC_LIBRARY="/usr/lib/arm-linux-gnueabihf/libCbcSolver.so.3.9.9"
export LD_LIBRARY_PATH="/usr/lib/arm-linux-gnueabihf/"
as established here.
Then, when I try to execute it on Python's console, I do:
>> from mip import Model, MAXIMIZE, CBC, INTEGER, OptimizationStatus
>> model = Model(sense=MAXIMIZE, solver_name=CBC)
And I inmediately get the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/dist-packages/mip/model.py", line 93, in __init__
import mip.cbc
File "/usr/local/lib/python3.7/dist-packages/mip/cbc.py", line 600, in <module>
Osi_getNumCols = cbclib.Osi_getNumCols
File "/usr/local/lib/python3.7/dist-packages/cffi/api.py", line 912, in __getattr__
make_accessor(name)
File "/usr/local/lib/python3.7/dist-packages/cffi/api.py", line 908, in make_accessor
accessors[name](name)
File "/usr/local/lib/python3.7/dist-packages/cffi/api.py", line 838, in accessor_function
value = backendlib.load_function(BType, name)
AttributeError: function/symbol 'Osi_getNumCols' not found in library '/usr/lib/arm-linux-gnueabihf/libCbcSolver.so.3.9.9': /usr/lib/arm-linux-gnueabihf/libCbcSolver.so.3.9.9: undefined symbol: Osi_getNumCols
I am using
Python 3.7.3
mip 1.12.0
coinor-cbc 2.9.9+repack1-1
Debian GNU/Linux 10 (buster)
Kernel: Linux 4.14.78-g8e54a4b
Architecture: armv7l
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Okay, so I did install it with
Which installed latest release,
Is this still an incorrect version of CBC? |
You need to do
to get the development version, but you should remove the |
Thank you! I will test that out. It also happens with: |
In general, you shouldn't need to set any flags manually like you have. I assumed you had some specific reason for doing that and didn't look too closely at them. You usually would not need any flag such as If you want to build static executables, which it looks like you are trying to do, just add If necessary, you can augment the pre-defined flags using |
I tried this today and it worked, however it seems that the library has been renamed in the Cbc master To make it work with Python-MIP you need to do the following after the
This is for MacOS, for Linux probably replace Using this command, I got Python-MIP working on a Mac M1 ('Apple silicon'). In the long run, hopefully Python-MIP will distribute appropriate binaries and 'freeze' the Cbc version it is using. EDIT Mar 9, 2022: It also works to point
(Define |
Yes, there used to be a We are still trying to get to a formal release of the code in Cbc |
Much appreciated Ted! I was following the Python-MIP documentation which mentions dynamic linking: "Python-MIP uses the CbcSolver shared library [...] In [...] MacOS the extension should be |
Sorry, I misspoke. I didn't mean to say dynamic linking, I meant symbolic linking. You created a symbolic link from |
Indeed, that works as well, thanks! |
Leaving this here for reference I've just gotten an M1 Mac and I found that using CBC built from today's master failed some tests in my application - mostly just extreme edge cases, so I guess it's just normal variance between different versions of CBC. But I wanted to have CBC as identical as possible to what's in python-mip v1.13.0 So I wanted to build CBC for M1 Mac using the exact same version of CBC that's used in python-mip 1.13.0. When building CBC master version using coinbrew it seems that coinbrew checks out master versions of all the dependencies, if I'm interpreting the contents of the .coin-or folder correctly So, I've put together a little script that checks out all the dependent repositories to master at the time that I want and then builds CBC. And it seems to work, just need env var # see https://stackoverflow.com/a/6990682 for git checkout to specific date
bash coinbrew fetch Cbc@master
cd Cbc
git checkout `git rev-list -n 1 --before="2020-11-15T22:41:00Z" --date=iso master`
cd ../Cgl
git checkout `git rev-list -n 1 --before="2020-11-15T22:41:00Z" --date=iso master`
cd ../Clp
git checkout `git rev-list -n 1 --before="2020-11-15T22:41:00Z" --date=iso master`
cd ../CoinUtils
git checkout `git rev-list -n 1 --before="2020-11-15T22:41:00Z" --date=iso master`
cd ../Osi
git checkout `git rev-list -n 1 --before="2020-11-15T22:41:00Z" --date=iso master`
cd ../ThirdParty/ASL
git checkout `git rev-list -n 1 --before="2020-11-15T22:41:00Z" --date=iso master`
cd ../Glpk
git checkout `git rev-list -n 1 --before="2020-11-15T22:41:00Z" --date=iso master`
# mumps doesn't seem to have a master branch
# cd ../Mumps
# git checkout `git rev-list -n 1 --before="2020-11-15T22:41:00Z" --date=iso master`
cd ../..
bash coinbrew build Cbc -j 1 --no-third-party --tests none |
Yes, in fact,
It's admittedly not been used (by me) since when I actually needed it and added it as an option. If you have a chance to try it, that would be great. |
I installed coinor-cbc to my
armhf
system, and did this:as established here.
Then, when I try to execute it on Python's console, I do:
And I inmediately get the error:
I am using
The text was updated successfully, but these errors were encountered: