coin-or / python-mip

Python-MIP: collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Eclipse Public License 2.0
518 stars 92 forks source link

NameError: name 'cbclib' is not defined #167

Open tehhauchua opened 3 years ago

tehhauchua commented 3 years ago

Hi

I noticed that the previous issue (#37) has already been close. I have decided to open a new one.

I am relatively new to Python. Below are my settings: mip in c:\users\user\anaconda3\lib\site-packages (1.13.0) python 3.8 Window 10

I tried to run this as well: www.decom.ufop.br/haroldo/files/cbc.exe

Is there anything I missed in order to fix this problem?

Appreciate your help.

Thank you.

Teh Hau

CaetanoSlavieroPires commented 3 years ago

I had the same problem now. Print the version of your python (import sys; print(sys.version); ) and discover if it is 32 ou 64. I was running the 32 version and CBC is not supported on 32. When I changed to 64 it worked. Also, I am using MIP version 1.5.3, I don't know if this solution will work on another version.

Silventino commented 2 years ago

Hello there! A good workaround is using WSL with Ubuntu to run Python-MIP.

sluis63 commented 2 years ago

Hi,

I have the same problem, however the first line from the error I got was not mentioned before.

An error occurred while loading the CBC library: Win32 platform not supported. Traceback (most recent call last): File "C:\Users\test\PycharmProjects\FirstModels.py", line 33, in m = Model("knapsack", solver_name=CBC) File "C:\Users\test\PycharmProjects\venv\lib\site-packages\mip\model.py", line 87, in init import mip.cbc File "C:\Users\test\PycharmProjects\venv\lib\site-packages\mip\cbc.py", line 603, in Osi_getNumCols = cbclib.Osi_getNumCols NameError: name 'cbclib' is not defined

I am currently using PyCharm 2022.1.3 (Community Edition) Build #PC-221.5921.27, built on June 21, 2022 Runtime version: 11.0.15+10-b2043.56 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 10 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 992M Cores: 4

It seems that the sys package does not detect the correct platform. With the following lines in PyCharm:

from sys import platform, maxsize print(maxsize, platform) I get: 2147483647 win32 In the cbc.py file (at line 48) the boolean os_is_64_bit becomes false and the win64 version of cbc will not be loaded.

Any help would be appreciated.

Thanks, Erik van der Sluis

ortiz1093 commented 1 year ago

What if WSL is not an option?

erelsgl commented 1 year ago

I have a similar problem.

sluis63 commented 1 year ago

I haven't fixed the problem, but I believe you require an Intel processor for Python-MIP. The PC that I was using has an AMD processor. It works fine now on my HP ProBook with i5 processor.

tusiqi1 commented 9 months ago

I also have the same problem in : python 3.11.5 mip=1.15 cpu: intel xeon E502650 linux 3.10.0-1160.el7.x86_64

vpozdnyakov commented 8 months ago

the same on mac m1

tuliotoffolo commented 8 months ago

Hi, I will get an M1 soon and try to fix this issue. I’ll also look for a solution for AMD processors.

pabloazurduy commented 8 months ago

hey, has anyone found a workaround for this issue? 🙏 thaaanks

pabloazurduy commented 8 months ago

hey, I managed to find a workaround on a M1 pro MacBook: create a conda env using x86 arch

CONDA_SUBDIR=osx-64 conda create -n myenvmip python=3.10.10 mip 
conda activate myenvmip

done :), probably is not efficient but, works