Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Issue with CBC library in Python-MIP on macOS ARM64 (Apple Silicon)

Open
#406 6 comments 1 reaction 0 assignees View on GitHub

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

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coin-or/python-mip

All issues in coin-or/python-mip

Similar issues

More Operating Systems issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.