'Having trouble accessing ortools on M1 mac

I have macOS Monterey version 12.0.1. I have been having a lot of trouble installing ortools. I followed these instructions:

https://www.devforce.one/14677478/how-to-install-google-or-tools-on-apple-m1-arm64#/google_vignette

However, I am still getting ModuleNotFoundError: No module named 'ortools'.

When I did the installation, I was inside the directory which has the file I am trying to run (/Users/hannahamilton/Desktop/local_function). Also, I had activated my virtual environment. Could the issue be that ortools is just installed in the wrong place? Requirement already satisfied: ortools in /Users/hannahamilton/Library/Python/3.9/lib/python/site-packages (9.3.10497)



Solution 1:[1]

I have a Mac M1, building or-tools is supported directly.

Just checkout the master branch

git clone -b master https://github.com/google/or-tools.git

install xcode, swig, cmake, native arm python

In python, install mypy-grotobuf.

python3 -m pip install mypy-protobuf

Make sure the associated script is accessible on the PATH (I added $HOME/Library/python3.10/bin to the PATH as I use python 3.10)

Then cd into or-tools and type make python.

The python wheel package will be in the build_make/python/dist sub-directory.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1