Question
How to solve :ImportError: dlopen(/.../XXX.so, 0x0002): symbol not found in flat namespace '_gsl_sf_gamma'"
When I run a function in a python package, it returns:
import gala.potential as gp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/homebrew/lib/python3.11/site-packages/gala/potential/__init__.py", line 1, in <module>
from .potential import *
File "/opt/homebrew/lib/python3.11/site-packages/gala/potential/potential/__init__.py", line 2, in <module>
from .cpotential import *
ImportError: dlopen(/opt/homebrew/lib/python3.11/site-packages/gala/potential/potential/cpotential.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '_gsl_sf_gamma'
As the error message contains "_gsl_sf_gamma", so I suppose the problem is coming from the GSL library of C/C++.
I am using Mac with M2 Chip. I have installed GSL before by homebrew, so the path of GSL is
/opt/homebrew/Cellar/gsl/2.7.1
Moreover, I have also installed gcc before by homebrew.
However, the default gcc is installed from Xcode, which uses clang and its path is
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I suppose the problem is from the inconsistency between the GSL and the gcc.
I have tried to reinstall GSL through conda (without uninstall the previous GSL), but it doesn't work.