pytezos icon indicating copy to clipboard operation
pytezos copied to clipboard

M1 Pro pip installation error

Open konchunas opened this issue 3 years ago • 3 comments

I had a hard time installing onto M1 machine. It always results in secp256k1 and gmp can't find either include or lib paths. Even if I have them installed using brew according to documentation.

The only way I managed to install pytezos it is by adding some environment variables with paths like so:

CFLAGS="-I/opt/homebrew/Cellar/gmp/6.2.1_1/include/ -L/opt/homebrew/Cellar/gmp/6.2.1_1/lib/" LIB_DIR="/opt/homebrew/Cellar/libsecp256k1/0.1/lib" INCLUDE_DIR=/opt/homebrew/Cellar/libsecp256k1/0.1/include pip3 install --user pytezos

This was enough to install, but no enough to run pytest. I had to add LD_LIBRARY_PATH=/opt/homebrew/lib/ to my env so it can find libsodium when executing pytest.

It all seems to be related to the fact that brew installs all ARM libraries to /opt/homebrew/ and x64 to /usr/local/. And /usr/local/ is always in the default paths for C compiler while /opt/homebrew/ is not.

I am confident the same result can be achieved more elegantly. That's why I'm not sure if it is wise to include this to the documentation yet.

konchunas avatar Jan 12 '22 13:01 konchunas

Thanks for your feedback, greatly helpful ! Unfortunately, somehow, we're still not managing to import pytezos on one of our dev's M1. Pytezos installs fine but cannot find libsodium. We'll look into it sometime when we can, until then, I'm making a docker compose, hopefully that works, and otherwise, I guess we'll Ubuntu VM it from the M1....

tbinetruy avatar May 18 '22 11:05 tbinetruy

Ok, on some macos systems, you need to export DYLD_LIBRARY_PATH=/opt/homebrew/lib/ rather than LD_LIBRARY_PATH ;)

tbinetruy avatar Aug 04 '22 13:08 tbinetruy

Another workaround by @grum-tez https://tezos.stackexchange.com/questions/6194/unable-to-find-libsodium-issue-with-pytezos https://github.com/grum-tez/pyTezosDC

m-kus avatar Jul 31 '23 10:07 m-kus