google / s2geometry

Computational geometry and spatial indexing on the sphere
http://s2geometry.io/
Apache License 2.0
2.29k stars 302 forks source link

Reason: tried: '/usr/lib/libs2.0.dylib' (no such file) #275

Open francesco98 opened 1 year ago

francesco98 commented 1 year ago

Hello,

I'm trying to compile the library to be used in python, but I'm receiving an error while trying to import it with import pywraps2 as s2:

Traceback (most recent call last): File "/Users/franpo/Projects/s2-geometry/Projects/test.py", line 5, in <module> import pywraps2 as s2 File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pywraps2.py", line 15, in <module> import _pywraps2 ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_pywraps2.so, 0x0002): Library not loaded: '@rpath/libs2.0.dylib' Referenced from: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_pywraps2.so' Reason: tried: '/usr/lib/libs2.0.dylib' (no such file)

I successfully installed the library using the following commands: cmake -DCMAKE_CXX_STANDARD=14 -DCMAKE_PREFIX_PATH=~/libraries/abseil -DOPENSSL_ROOT_DIR=/opt/homebrew/Cellar/openssl@3/3.0.5 -DWITH_PYTHON=ON sudo make install

In my opinion the problem is that on my Mac M1 the library has been installed in /usr/local/lib/libs2.dylib, but Python is trying to load it from /usr/lib/libs2.0.dylib. I tried with export LD_LIBRARY_PATH=/usr/local/lib, but it does not change anything..

Do you have any idea?

aliwo commented 1 year ago

Hi, I'm struggling with building too, and now I'm using docker image + pycharm remote interpreter (https://github.com/bjlittle/docker-s2geometry) (I thought this might be helpful until you find the solution)

Cheers :)