Issue with CBC library in Python-MIP on macOS ARM64 (Apple Silicon)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- macos, python
- Domain
- operating-systems, tooling
Research direction
Start by reproducing the CBC loading failure in Spyder and comparing its environment with the terminal invocation. Inspect the python-mip CBC library-loading path and determine whether the ARM64 Homebrew library is selected; done means the model initializes in Spyder without the architecture mismatch or subsequent NameError.
Written by the indexing model from the issue text.
Description
Hi, I’m trying to run a Python script that uses the python-mip library with the CBC solver on a MacBook with an ARM64 (Apple Silicon) chip.
-
I’ve installed CBC correctly using Homebrew (brew install cbc), and I can verify its availability by running cbc --version in the terminal.
-
However, when I run my script in Spyder, I get the following error:
An error occurred while loading the CBC library: cannot load library 'cbc-c-darwin-x86-64.dylib'...
mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')
....
NameError: name 'cbclib' is not defined
- I checked that my CBC installation is for ARM64 using:
file /opt/homebrew/lib/libcbc.dylib
Output: Mach-O 64-bit dynamically linked shared library arm64
- I have also added the following environment variables in my script before importing mip:
import os
import ctypes
os.environ["DYLD_LIBRARY_PATH"] = "/opt/homebrew/lib:/opt/anaconda3/lib"
os.environ["PATH"] = "/opt/homebrew/bin:" + os.environ.get("PATH", "")
ctypes.CDLL("/opt/homebrew/lib/libcbc.dylib")
from mip import Model, CBC
model = Model(solver_name=CBC)
Despite these efforts, the issue persists. The script runs fine from the terminal, but in Spyder, I still get the architecture mismatch error.
I would appreciate any suggestions on how to force python-mip to use the correct version of CBC installed via Homebrew or how to resolve this compatibility issue in Spyder.
Thanks in advance.
- Dominant language
- Linear Programming
- Stars
- 602
- Forks
- 108
- Avg merge
- 1d 22m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coin-or/python-mip
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
coin-or/python-mip#426 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
coin-or/python-mip#425 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
coin-or/python-mip#423 · 4 comments · 3 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
coin-or/python-mip#422 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
coin-or/python-mip#420 · 4 comments ·
All issues in coin-or/python-mip
Similar issues
-
A SKILL.md larger than max_skill_size is read whole through the mountPossibly taken @Frun1na claimed this today. Opencomponent:skillfs
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
agentic-os-org/ANOLISA#6060 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
apple/swift-system#400 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
intel/intel-lpmd#137 ·
Maintainers usually reply within 1 day
-
systemd-binfmt exits 1 when the binfmt_misc flush fails, even though all rules register successfullyPossibly taken @turbcool claimed this today. Openbinfmt
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100