patrick-kidger/signatory

Installation on M1 Macbook

amandlek opened this issue · 4 comments

Thanks for the great codebase! I was trying to install it on my M1 Macbook Air using the command pip install signatory==1.2.6.1.8.0 --no-cache-dir --force-reinstall (I already have pytorch 1.8.0 installed), but I get a giant error message. Some of the more prominent warnings include the compiler warning below (screenshot attached), an error clang: error: unsupported option '-fopenmp', and RuntimeError: Error compiling objects for extension. I'd be happy to provide the full error trace if it would be helpful. Any pointers would be appreciated - thank you!

Screen Shot 2022-02-02 at 1 58 02 PM

Right, so. The short (unfortunate) version is that Signatory doesn't provide official support for macOS. I don't have access to a Mac myself so it wasn't really feasible to debug the build errors I was getting.

Some of the earlier versions of Signatory do support macOS -- version 1.2.3 was the latest to offer macOS support. You might be able to use that.

Alternatively, if you're familiar with the toolchain and how to make that kind of thing work, you can install Signatory from source, and compile the C++ yourself. (That's actually what pip is trying to do for you automatically, and what is giving you the big error you see.) This is definitely possible -- and probably not too bad if you have some familiarity with this kind of thing -- but it's not something I'd be able to help debug.

I see - thanks for the help!

I was able to successfully install the library! I'm posting the steps that worked for me in case it helps someone else.

First, I ran brew install llvm. Then, I ran the following commands in sequence.
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
MACOSX_DEPLOYMENT_TARGET=11.3.1 CC=clang CXX=clang++ pip install signatory==1.2.6.1.8.0 --no-binary signatory

The deployment target and the signatory version in the last command should be replaced by your MacOS version, and the version of signatory you'd like to install.

Thanks a lot !
Your method also worked on M3 Max, MaxOS 14.3.1, Python 3.12.2 and PyTorch 2.1.2 (hooray for MPS !)
I used signatory==1.2.6.1.9.0