pytezos
pytezos copied to clipboard
M1 Pro pip installation error
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.
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....
Ok, on some macos systems, you need to export DYLD_LIBRARY_PATH=/opt/homebrew/lib/
rather than LD_LIBRARY_PATH
;)
Another workaround by @grum-tez https://tezos.stackexchange.com/questions/6194/unable-to-find-libsodium-issue-with-pytezos https://github.com/grum-tez/pyTezosDC