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

CMake(Python): Requesting prebuilt wheels for M1 macOS without SCIP #2722

Closed
machinaut opened this issue Aug 9, 2021 · 8 comments
Closed
Assignees
Labels
Build: CMake CMake based build issue Feature Request Missing Feature/Wrapper Lang: Python Python wrapper issue OS: Mac MacOS
Milestone

Comments

@machinaut
Copy link
Contributor

What language and solver does this apply to?
Python

Describe the problem you are trying to solve.
pip install ortools fails on M1 Mac.

Describe the solution you'd like
Install succeeds with a prebuilt wheel which does not include SCIP (which still doesn't build/run on M1 Macs / arm64)

Describe alternatives you've considered
Building from source works, #2332 (comment)

Additional context
Add any other context or screenshots about the feature request here.

@Mizux Mizux added Cross Compilation Cross compiling (e.g. aarch64) Feature Request Missing Feature/Wrapper Lang: Python Python wrapper issue labels Aug 12, 2021
@Mizux Mizux self-assigned this Aug 13, 2021
@Mizux Mizux added this to the v9.2 milestone Aug 13, 2021
@Mizux Mizux changed the title Requesting prebuilt wheels for arm64 macs without SCIP Python: Requesting prebuilt wheels for M1 macs without SCIP Aug 13, 2021
@Mizux
Copy link
Collaborator

Mizux commented Aug 13, 2021

Did you try to build from source using the CMake based build ?

cmake -S. -Bbuild -DUSE_SCIP=OFF -DBUILD_DEPS=ON -DBUILD_PYTHON=ON
cmake --build build

ref: https://github.com/google/or-tools/blob/master/cmake/README.md

I still don't know if building the python package will work but you should give it a try, any feedback are welcome and we can help you to fix issues.

FYI we already manage to publish a C++ package of ortools on homebrew for "Apple Silicon"
ref: https://formulae.brew.sh/formula/or-tools#default

@Mizux Mizux changed the title Python: Requesting prebuilt wheels for M1 macs without SCIP CMake(Python): Requesting prebuilt wheels for M1 macOS without SCIP Aug 13, 2021
@jcpaik
Copy link

jcpaik commented Sep 10, 2021

Just a note. I managed to build CMake(Python) from source without SCIP and COIN-OR. I'm using an iMac M1 desktop.

brew install swig
brew install or-tools
cmake -S. -Bbuild -DUSE_SCIP=OFF -DUSE_COINOR=OFF -DBUILD_DEPS=ON -DBUILD_PYTHON=ON
cmake --build build

I've installed a bunch of packages before to make it work, so some packages might be missing in the commands above. But fortunately if cmake complains about something, brew seems to have what it needs. I also installed C++ package or-tools beforehand and don't know if that helped in any way or not.

The last command fails at installing the final wheel file in or-tools/build/python/dist. I had to change the the file name ortools-9.0.9050-cp38-cp38-os_info_i_cant_remember.whl to ortools-9.0.9050-cp38-none-any.whl to bypass the OS compatibility check of pip. Manually installing the wheel file with pip, I got CP-SAT working at the end.

@Mizux
Copy link
Collaborator

Mizux commented Oct 6, 2021

@jcpaik if you have an apple M1, could you install the auditwheel package:

python3 -m pip show auditwheel
# if not installed
python3 -m pip install --user auditwheel

then run

python3 -m auditwheel repair -h

you should see a PLATFORMS list at the end:
example on my x86_64 archlinux

python3 -m auditwheel repair -h
...
PLATFORMS:
These are the possible target platform tags, as specified by PEP 600.
Note that old, pre-PEP 600 tags are still usable and are listed as aliases
below.
- linux_x86_64
- manylinux_2_5_x86_64 (aliased by manylinux1_x86_64)
- manylinux_2_12_x86_64 (aliased by manylinux2010_x86_64)
- manylinux_2_17_x86_64 (aliased by manylinux2014_x86_64)
- manylinux_2_24_x86_64
- manylinux_2_27_x86_64

I need it:

  1. to check if M1 has a little name
  2. it is mandatory to use them otherwise the (wheel) package will be rejected upon uploading to pypi.org -> no way to publish it even if we manage to build it...

@jcpaik
Copy link

jcpaik commented Oct 6, 2021

@Mizux I'm getting this. I need to see why I'm getting 'Failed to determine libc version' but I don't have time for this right now.

❯ python3 -m pip show auditwheel

Name: auditwheel
Version: 5.0.0
Summary: Cross-distribution Linux wheels
Home-page: https://github.com/pypa/auditwheel
Author: Robert T. McGibbon
Author-email: rmcgibbo@gmail.com
License: MIT
Location: /Users/jcpaik/Library/Python/3.9/lib/python/site-packages
Requires: pyelftools
Required-by:
❯ python3 -m auditwheel repair -h

Failed to determine libc version
Traceback (most recent call last):
  File "/Users/jcpaik/Library/Python/3.9/lib/python/site-packages/auditwheel/musllinux.py", line 20, in find_musl_libc
    ldd = subprocess.check_output(["ldd", "/bin/ls"], errors="strict")
  File "/opt/homebrew/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/opt/homebrew/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/opt/homebrew/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/homebrew/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ldd'
Error: This tool only supports Linux

@vitormhenrique
Copy link

@jcpaik would you mind sharing your wheel package?

@jcpaik
Copy link

jcpaik commented Jan 24, 2022

@vitormhenrique Do you mean the wheel file? I could but I'm afraid if you will ever be able to trust the file (e.g. to be free of any virus or put any guarantee etc). Could you try using CMake to build like I described above?

@marcosfelt
Copy link

I just installed OR-tools from source on a Macbook Air M1. Figured I'd share the exact steps I followed:

# Clone the latest commit on the stable branch of the repository
git clone --depth 1 https://github.com/google/or-tools.git --branch stable
cd or-tools

# Install cmake and swig
brew install swig cmake

# Install virtualenv and mypy-protobuf
pip install mypy-protobuf virtualenv

# Instructions from @jcpaik to build the package
cmake -S. -Bbuild -DUSE_SCIP=OFF -DBUILD_DEPS=ON -DBUILD_PYTHON=ON
cmake --build build

# Create a virtual environment and install or-tools there
python3 -m venv .venv
source .venv/bin/activate
cd build/python
pip install .

@Mizux Mizux removed this from the v9.3 milestone Feb 11, 2022
@lperron
Copy link
Collaborator

lperron commented Aug 31, 2022

We delivered native M1 builds with version 9.4

@lperron lperron closed this as completed Aug 31, 2022
@Mizux Mizux modified the milestones: v10.0, v9.5 Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build: CMake CMake based build issue Feature Request Missing Feature/Wrapper Lang: Python Python wrapper issue OS: Mac MacOS
Projects
None yet
Development

No branches or pull requests

6 participants