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

Issues running the latest versions of Python-MIP on AWS lambda functions #334

Open
jerak opened this issue Feb 10, 2023 · 8 comments
Open
Labels
cbc All items related to cbc

Comments

@jerak
Copy link

jerak commented Feb 10, 2023

Bug
With the two latest versions of Python-MIP (1.14.0 and 1.15.0) I seem to have issues running on AWS lambda functions. When calling the lambda function, the issue that appears is the following:

import mip.cbc\n File \"/tmp/sls-py-req/mip/cbc.py\", line 603, in <module>\n Osi_getNumCols = cbclib.Osi_getNumCols\nNameError: name 'cbclib' is not defined\n"

This issue is also reported in other places, and, as far as I understand it, the proposed solution is to add the CBC binaries manually, as described here: https://python-mip.readthedocs.io/en/latest/install.html

This solved the aforementioned error. However, this seems to be resulting in much longer solving times (sometimes more than doubling). Is this a known or explainable issue? Are there alternatives for resolving the initial problem?

Important to mention is that the reason for wanting to upgrade from 1.13.0 to 1.15.0 is that when calling the solver multiple times in a row, the solver sometimes seems to get stuck in an infinite loop (reproducing the error doesn't seem to be easy, as it seems to be machine/OS-dependent). My guess was that that issue was solved in coin-or/Cbc@e008a36

Lambda function specifications:

@jerak
Copy link
Author

jerak commented Feb 10, 2023

When digging deeper into this, I noticed that the following error occurred prior to the aforementioned error:
An error occurred while loading the CBC library: cannot load library '/var/lang/lib/python3.9/site-packages/mip/libraries/cbc-c-linux-x86-64.so': /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /var/lang/lib/python3.9/site-packages/mip/libraries/cbc-c-linux-x86-64.so).

@jerak
Copy link
Author

jerak commented Feb 16, 2023

When following the steps for adding custom binaries, as described on this page: https://docs.python-mip.com/en/latest/install.html#using-your-own-cbc-binaries-optional, I noticed that the files are very small (e.g. ligCbc.so is 0kb, libCbc.so.0.0 is the largest file, with 2294kb. Also, I get a lot of files with similar names (all with .so, so.0, so.0.0 and .la) extensions, instead of 1 large file named libCbcSolver.so. Any ideas if there is something that I am doing wrong?

@rschwarz
Copy link
Contributor

The other files are probably symbolic links to the main file.

@jerak
Copy link
Author

jerak commented Feb 21, 2023

Thank you, that makes sense. So that is not completely unexpected? Is the fact that adding those custom binaries results in longer runtimes to be expected? Do you by any chance have another potential direction?

Thanks a lot for your help!

@rschwarz
Copy link
Contributor

No, it is standard practice to provide these symlinks.

As to longer runtimes: There may be compilation options that enable certain optimizations, having an impact on runtime.

@jerak
Copy link
Author

jerak commented Feb 22, 2023

Thank you, that might explain it indeed. Are you able to indicate what those options might be, so that I can try the same options on my side?

@rschwarz
Copy link
Contributor

No, sorry, I'm not familiar with the building of CBC.

@tkralphs
Copy link
Member

The symbolic links are part of the standard way that versioning is done with virtually all Linux packages. It's a mechanism by which you can drop in a new version of a library without breaking everything that depends on that library. If you do something like ls /usr/lib on a Linux box, you will see all libraries have these symbolic links installed.

The default build options should be fine in general, but there are some third-party libraries that can improve performance. Take a look at the builds on Github Actions to see what libraries are installed, e.g., https://github.com/coin-or/Cbc/blob/84625a5eae4e367d4d165669fa8e532f0c5e0dac/.github/workflows/linux-ci.yml#L24.

@sebheger sebheger added the cbc All items related to cbc label Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cbc All items related to cbc
Projects
None yet
Development

No branches or pull requests

4 participants