-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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): Installing OR Tools for Python on a M1 Processor Mac #2332
Comments
+1 to the issue. I have the same problem, and no solution yet. |
I have no M1 hardware :-)
Laurent Perron | Operations Research | [email protected] | (33) 1 42 68 53
00
Le mer. 13 janv. 2021 à 22:38, Anna Schneider <[email protected]> a
écrit :
… +1 to the issue. I have the same problem, and no solution yet.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3P6YXFCWHOFMPX7GNTSZYHETANCNFSM4V7PMD4A>
.
|
Are there any plans for building a distribution for this hardware? This is probably going to be a problem for many more users in the future since Apple are double downing on this chip. I offer my help with testing etc. if needed! Thanks. |
My understanding:
|
ref: react-native-community/discussions-and-proposals#295 (comment) |
Hi @NatanMish, do you mind downgrading your python into 3.8? I using 3.91 also faced the no found error. but 3.8 can. FYI, my mac is not m1 mac. Just a suggestion. |
@NatanMish could you run this python command so we can know how python3 see a M1 hardware: import os
import platform
print(f'os name: {os.name}')
print(f'processor: {platform.processor()}')
print(f'machine: {platform.machine()}')
print(f'system: {platform.system()}')
print(f'release: {platform.release()}')
print(f'uname: {platform.uname()}') |
|
Thanks @Mizux ! |
Thanks @DanielChuDC but I already tried and couldn't find a distribution either. |
@NatanMish many thanks ! I'll try to see, if using the linaro aarch64 cross compile toolchain, I can build an arm64 version of ortools... |
@NatanMish can check it out. I using
|
Hey @DanielChuDC yeah I was using pip 20.3.3 too, that is not the issue. |
could be related to pypa/packaging#319 note to myself: python/cpython#21246 |
Trying to compile from source on M1, you'll hit issues during I was able to compile everything after making those changes to the makefile: Netlift@bbfcaa5
Trivia: |
@gboudreau Thanks for sharing!
|
I should have said that I am working in a Linux docker container, so the fixes I made were for Linux aarch64 really (but they also fix architecture issues when building on/for Mac). The error you show above doesn't seem related to the M1 architecture; looks like a syntax problem, which could happen if the toolchain used to compile doesn't support the right version of the syntax used by the source (the SCIP third-party library). My guess would be an incompatibility between the latest Xcode build tools and that library. To validate, someone on Big Sur and using an Intel processor, and latest Xcode could try compiling or-tools from source. |
You can pass USE_SCIP=OFF to cmake, or define it in Makefile.local if using
make to disable SCIP.
Laurent Perron | Operations Research | [email protected] | (33) 1 42 68 53
00
Le sam. 23 janv. 2021 à 20:36, NatanMish <[email protected]> a
écrit :
… @gboudreau <https://github.com/gboudreau> Thanks for sharing!
but unfortunately make third party still doesn't work. Here is the output:
src/nlpi/exprinterpret_cppad.cpp:102:38: error: expected ';' after top level declarator
static std::atomic_size_t ncurthreads{0};
^
;
src/nlpi/exprinterpret_cppad.cpp:103:8: error: unknown type name 'thread_local'
static thread_local int thread_number{-1};
^
src/nlpi/exprinterpret_cppad.cpp:103:38: error: expected ';' after top level declarator
static thread_local int thread_number{-1};
^
;
3 errors generated.
make[2]: *** [obj/static/O.darwin.arm.gnu.opt/lib/nlpi/exprinterpret_cppad.o] Error 1
make[1]: *** [libnlpi] Error 2
make: *** [dependencies/install/lib/libscip.a] Error 2
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3IXVIHQBGLDUWKRK2TS3MQMBANCNFSM4V7PMD4A>
.
|
Unfortunately this doesn't work because of #2333 |
Maybe off topic but what part of or-tools do you plan to use ? I know that cp-sat solver was on notebook with only 2 real cores pretty useless. M1 is not x86 architecture, has two types of cores (performance and slow) which is normal in arm world but not in x86 ... highly probably some time will be needed to tweak performance for this architecture. Not to mention that it is probably better to wait for more powerful variant (desktop, more cores) of M1 to justify the effort for new architecture primarily in multicore tasks. |
yes, but the toolchain we use creates universal2 binaries with only the
x86_64 libraries in.
So I guess it works on M1 through emulation.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le mer. 12 janv. 2022 à 11:43, dalan ***@***.***> a écrit :
… I believe the python stack does not support the M1 natively.
Looks like it started supporting Apple Silicon natively since Python 3.9
(Dec 2020) using the universal2 binaries.
https://www.python.org/downloads/release/python-391/
—
Reply to this email directly, view it on GitHub
<#2332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3POLKOMWWPTMTI7CPDUVVLM3ANCNFSM4V7PMD4A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yes, indeed. Install ortools using pip works on a rosetta emulated terminal. But you can expect some serious slowdowns... |
The binaries in the universal2 wheels are only for x86_64. You can verify this by downloading the wheel and running ➜ lipo -archs linear_solver/_pywraplp.so
x86_64 |
@machinaut or @jcpaik would you guys mind sharing your compiled wheel packages? |
any news on this issue? I use the dylib with Java and it doesn't work |
https://discord.com/channels/693088862481678374/948196025204633620
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le ven. 4 mars 2022 à 17:19, Joaquin Santana ***@***.***> a
écrit :
… any news on this issue? I use the dylib with Java and it doesn't work
—
Reply to this email directly, view it on GitHub
<#2332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3LL4CZLFR2QKI3TSQTU6IZYFANCNFSM4V7PMD4A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
You should be able to build a python M1 package to check: python -c "import platform as p;print(p.machine(), p.platform())" Then to build: cmake -S. -Bbuild -DBUILD_PYTHON=ON -DPython3_ROOT_DIR="path_of_your_python_install"
cmake --build build -j4 -v you'll have the wheel package in |
My 2 cents to compile and install or-tools with M1 mac using Python 3.9 installed with Homebrew: git clone https://github.com/google/or-tools.git
cd ./or-tools
cmake -S. -Bbuild -DBUILD_PYTHON=ON -DPython3_ROOT_DIR="/opt/homebrew/Cellar/[email protected]/3.9.10/"
cmake --build build -j8 -v
pip3 install ./build/python/dist/ortools-9.2.9974-cp39-cp39-macosx_12_0_arm64.whl |
I believe you need 3.10 to generate a native M1 lib.
Le lun. 7 mars 2022, 18:25, Enrico ***@***.***> a écrit :
… My 2 cents to compile and install or-tools with M1 mac using Python 3.9
installed with Homebrew:
git clone https://github.com/google/or-tools.gitcd ./or-tools
cmake -S. -Bbuild -DBUILD_PYTHON=ON ***@***.***/3.9.10/"
cmake --build build -j8 -v
pip3 install ./build/python/dist/ortools-9.2.9974-cp39-cp39-macosx_12_0_arm64.whl
—
Reply to this email directly, view it on GitHub
<#2332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3LVCQ6763PGMLCFVH3U6Y3Z5ANCNFSM4V7PMD4A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
On my mac, it works well with Python 3.9. |
It works, through the Rosetta emulation.
Le lun. 7 mars 2022, 20:57, Enrico ***@***.***> a écrit :
… I believe you need 3.10 to generate a native M1 lib. Le lun. 7 mars 2022,
18:25, Enrico *@*.***> a écrit :
On my mac, it works well with Python 3.9.
—
Reply to this email directly, view it on GitHub
<#2332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3PHJ4EED5FXZQGCW33U6ZNULANCNFSM4V7PMD4A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
mmm, I'm not sure, but I think I'm not under Rosetta: 🧐 [~]$ arch
arm64
[~]$ which python3
/opt/homebrew/bin/python3
[~]$ python3 -c "import platform as p;print(p.machine(), p.platform())"
arm64 macOS-12.2.1-arm64-arm-64bit
[~]$ python3
Python 3.9.10 (main, Jan 15 2022, 11:40:53)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ortools.linear_solver import pywraplp
>>> solver = pywraplp.Solver('Cart optimizer', pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)
>>> solver.__class__
<class 'ortools.linear_solver.pywraplp.Solver'>
>>> |
Good news then.
Thanks for checking
Le lun. 7 mars 2022, 23:29, Enrico ***@***.***> a écrit :
… It works, through the Rosetta emulation. Le lun. 7 mars 2022, 20:57,
Enrico *@*.***> a écrit :
mmm, I'm not sure, but I think I'm not under Rosetta: 🧐
[~]$ arch
arm64
[~]$ which python3
/opt/homebrew/bin/python3
[~]$ python3 -c "import platform as p;print(p.machine(), p.platform())"
arm64 macOS-12.2.1-arm64-arm-64bit
[~]$ python3
Python 3.9.10 (main, Jan 15 2022, 11:40:53)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ortools.linear_solver import pywraplp
>>> solver = pywraplp.Solver('Cart optimizer', pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)
>>> solver.__class__
<class 'ortools.linear_solver.pywraplp.Solver'>
>>>
—
Reply to this email directly, view it on GitHub
<#2332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3LYWKYRGAM4XQ7AQ2LU6Z7NHANCNFSM4V7PMD4A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
it failed for me on compile step (prelast line) that may be the reason:
last line is:
I'v got mypy-protobuf 3.2.0 any ideas ? |
I also have this issue. |
Same answer
Le lun. 9 mai 2022, 19:02, Joe Warrington ***@***.***> a
écrit :
… I also have this issue.
—
Reply to this email directly, view it on GitHub
<#2332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3P3IIWXINKDRI23NO3VJFAKJANCNFSM4V7PMD4A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
the script must be accessible from the path.
Which is not done by default on mac.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le ven. 1 avr. 2022 à 17:07, Artur ***@***.***> a écrit :
… My 2 cents to compile and install or-tools with M1 mac using Python 3.9
installed with Homebrew:
git clone https://github.com/google/or-tools.gitcd ./or-tools
cmake -S. -Bbuild -DBUILD_PYTHON=ON ***@***.***/3.9.10/"
cmake --build build -j8 -v
pip3 install ./build/python/dist/ortools-9.2.9974-cp39-cp39-macosx_12_0_arm64.whl
it failed for me on compile step with
--mypy_out: protoc-gen-mypy: Plugin failed with status code 1.
I'v got mypy-protobuf 3.2.0
any ideas ?
—
Reply to this email directly, view it on GitHub
<#2332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3PYL4BU7Z7I5DTAUF3VC4GLDANCNFSM4V7PMD4A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
What version of OR-tools and what language are you using?
Version: Trying to install OR Tools on a Mac OSX 11.1 with a M1 chip. No specific version.
Language: Python
What operating system (Linux, Windows, ...) and version?
Mac Big Sur 11.1 Apple M1 chip
I am using a conda environment with Python 3.9.1. What I've tried:
Installing using the binary distribution as instructed here: https://developers.google.com/optimization/install/python/mac
I receive the error message "No matching distribution found for ortools" which makes sense as from how it looks there is no version for this stack: https://pypi.org/project/ortools/#files
Installing from source as instructed here: https://developers.google.com/optimization/install/python/source_mac
My guess is maybe there are special adjustments needed to be done and a specific distribution to be released for this processor? or maybe I am missing something? Anyone had any experience with this kind of stack?
Any help would be appreciated!
Natan.
The text was updated successfully, but these errors were encountered: