JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.45k stars 186 forks source link

Specifying a pyenv virtual environment Python version fails on mac M1 due to incompatible architecture #996

Open pierreguilmin opened 1 year ago

pierreguilmin commented 1 year ago

Hello!

I am trying to build PyCall using a pyenv virtualenv, but I get the following error from dlopen

could not load library ".../.pyenv/versions/3.9.10/lib/libpython3.9.dylib" (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')

https://github.com/JuliaPy/PyCall.jl/blob/e81f9193d607c1b7c6c53bfbec9fde0bb13b5d3f/deps/buildutils.jl#L46

Complete output:

dlopen(/Users/pierreguilmin/.pyenv/versions/3.9.10/lib/libpython3.9.dylib) ==> ErrorException("could not load library \"/Users/pierreguilmin/.pyenv/versions/3.9.10/lib/libpython3.9.dylib\"\ndlopen(/Users/pierreguilmin/.pyenv/versions/3.9.10/lib/libpython3.9.dylib, 0x0009): tried: '/Users/pierreguilmin/.pyenv/versions/3.9.10/lib/libpython3.9.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
pierreguilmin commented 1 year ago

I guess I could try to install Python on a x86 environments using Rosetta (following this tutorial for example https://towardsdatascience.com/how-to-use-manage-multiple-python-versions-on-an-apple-silicon-m1-mac-d69ee6ed0250), but is there another way?