Installing OR Tools for Python on an M1 Processor Mac

978 views
Skip to first unread message

Natan Mish

unread,
Jan 12, 2021, 11:38:41 AM1/12/21
to or-tools-discuss
Hi all,

I have been trying to install OR Tools on my Mac Big Sur 11.1 with an Apple M1 chip with no luck so far. I am using a conda environment with Python 3.9.1. What I've tried:

1. 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

2. 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.

Jim Bumgardner

unread,
Mar 8, 2021, 2:38:54 PM3/8/21
to or-tools-discuss
I too am having issues with installing OR Tools on an M1 Mac using Big Sur 11.2.2.  Same error message for installing via Pip (using Python 3.9.2 and pip 21.0.1).  


Installing from source is quitting after this error:

./ortools/base/commandlineflags.h:17:10: fatal error: 'absl/flags/declare.h' file not found

Also, the third_party make quit after a few errors for src/nlpi/exprinterpret_cppad.cpp


Laurent Perron

unread,
Mar 8, 2021, 2:58:07 PM3/8/21
to or-tools-discuss
make third_party USE_SCIP=OFF, or make third_party -k to build absl
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/f7d510a2-29db-47cf-9fa7-801cb446716dn%40googlegroups.com.

Jim Bumgardner

unread,
Mar 8, 2021, 3:14:10 PM3/8/21
to or-tools-discuss
Thanks so much Laurent.  That got me a bit further.  Last set of errors on build python (note I am running MacOS 11.2.2):

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:2368:5: error: aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on macOS 10.14 or

      newer

    delete __ptr;

    ^

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:2623:7: note: in instantiation of member function 'std::__1::default_delete<operations_research::sat::ModelRandomGenerator>::operator()'

      requested here

      __ptr_.second()(__tmp);

      ^

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:2577:19: note: in instantiation of member function 'std::__1::unique_ptr<operations_research::sat::ModelRandomGenerator,

      std::__1::default_delete<operations_research::sat::ModelRandomGenerator> >::reset' requested here

  ~unique_ptr() { reset(); }

                  ^

./ortools/sat/model.h:203:14: note: in instantiation of member function 'std::__1::unique_ptr<operations_research::sat::ModelRandomGenerator,

      std::__1::default_delete<operations_research::sat::ModelRandomGenerator> >::~unique_ptr' requested here

    explicit Delete(T* t) : to_delete_(t) {}

             ^

./ortools/sat/model.h:148:36: note: in instantiation of member function 'operations_research::sat::Model::Delete<operations_research::sat::ModelRandomGenerator>::Delete' requested here

    cleanup_list_.emplace_back(new Delete<T>(t));

                                   ^

./ortools/sat/model.h:117:5: note: in instantiation of function template specialization 'operations_research::sat::Model::TakeOwnership<operations_research::sat::ModelRandomGenerator>' requested here

    TakeOwnership(new_t);

    ^

./ortools/sat/clause.h:462:24: note: in instantiation of function template specialization 'operations_research::sat::Model::GetOrCreate<operations_research::sat::ModelRandomGenerator>' requested here

        random_(model->GetOrCreate<ModelRandomGenerator>()),

                       ^

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:2368:5: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic

    delete __ptr;

    ^


- Jim

Laurent Perron

unread,
Mar 8, 2021, 5:30:54 PM3/8/21
to or-tools-discuss
try changing MAC_MIN_VERSION in makefiles/Makefile.port.mk to 10.14 

Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00


Jim Bumgardner

unread,
Mar 8, 2021, 6:09:16 PM3/8/21
to or-tools...@googlegroups.com
Definitely getting closer.

Third Party errors ("make third_party USE_SKIP=OFF")

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};


Warnings/Errors on build python

ortools/gen/ortools/linear_solver/lpi_glop.cc:1384:41: warning: format specifies type 'long' but the argument has type 'int64' (aka 'long long') [-Wformat]
      lpi->solver->GetObjectiveValue(), lpi->solver->GetNumberOfIterations());
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ortools/gen/ortools/linear_solver/lpi_glop.cc:1554:86: warning: format specifies type 'long' but the argument has type 'int64' (aka 'long long') [-Wformat]
            lpi->solver->GetObjectiveValue(), (int) lpi->solver->GetProblemStatus(), lpi->solver->GetNumberOfIterations());
                                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ortools/gen/ortools/linear_solver/lpi_glop.cc:1585:86: warning: format specifies type 'long' but the argument has type 'int64' (aka 'long long') [-Wformat]
            lpi->solver->GetObjectiveValue(), (int) lpi->solver->GetProblemStatus(), lpi->solver->GetNumberOfIterations());

clang: error: no such file or directory: '/Users/jbum/Development/or-tools/or-tools/dependencies/install/lib/libscip.a'
clang: error: no such file or directory: '/Users/jbum/Development/or-tools/or-tools/dependencies/install/lib/libnlpi.cppad.a'
clang: error: no such file or directory: '/Users/jbum/Development/or-tools/or-tools/dependencies/install/lib/liblpinone.a'
clang: error: no such file or directory: '/Users/jbum/Development/or-tools/or-tools/dependencies/install/lib/libtpitny-7.0.1.darwin.x86_64.gnu.opt.a'


You received this message because you are subscribed to a topic in the Google Groups "or-tools-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/or-tools-discuss/kMZe6Su0hC8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/CABcmEeZb_ZpV_9VQ1K%2B4fWjphf0bg0r1q7-MbfWLn%3DApSeuMiA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages