ImportError: symbol not found in flat namespace '___kmpc_barrier'
CCL installed in conda environment. The package cannot be called successfully.
Error message:
----> 1 import pyccl as ccl
File ~/opt/anaconda3/envs/uEnv/lib/python3.10/site-packages/pyccl/__init__.py:17
14 del environ, path
16 # SWIG-generated
---> 17 from . import ccllib as lib
19 # monkey patch for isitgr and fast-pt if Numpy>=1.24
20 from packaging.version import parse
File ~/opt/anaconda3/envs/uEnv/lib/python3.10/site-packages/pyccl/ccllib.py:16
14 # Import the low-level C/C++ module
15 if __package__ or "." in __name__:
---> 16 from . import _ccllib
17 else:
18 import _ccllib
ImportError: dlopen(/Users/shamik/opt/anaconda3/envs/uEnv/lib/python3.10/site-packages/pyccl/_ccllib.so, 0x0002): symbol not found in flat namespace '___kmpc_barrier'
Note: Installation on arm64 M1 Macbook with clang 14.0.6, python 3.10.9
To clarify, ccl was installed using conda? Is openmp installed in the conda env?
Yes, ccl was installed with conda (arm64) distribution. I find llvm-openmp installed in my conda environment.
I see this too! I just tried to install ccl globally from the cloned repository using:
pip install -e .
and I see:
Physics/CCL> python3 -c 'import pyccl'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/Mead/Physics/CCL/pyccl/__init__.py", line 17, in <module>
from . import ccllib as lib
File "/Users/Mead/Physics/CCL/pyccl/ccllib.py", line 19, in <module>
from . import _ccllib
ImportError: dlopen(/Users/Mead/Physics/CCL/pyccl/_ccllib.so, 0x0002): symbol not found in flat namespace '___kmpc_barrier'
This is pyccl-2.6.1 on a Mac with macOS 13.1, Python 3.10.9 and clang 14.0.0. I get a similar error if I install via pip install pyccl, and whether or not I install in an environment. If I do brew install libomp I see that I have the latest version 15.0.7.
I unfortunately can't reproduce this. I tried a fresh conda environment and both the conda and pip versions (pypi and locally) work for me. Tested on macOS 12.6.2, python 3.10 and 3.11, conda clang 14.0.6.
Hmm... could it be anything to do with an Xcode installation, or lack there of? At the moment I only have the command line tools installed, to save space.
That shouldn't matter I think. And especially not in a conda environment with it's own compilers.
@1cosmologist were you able to solve this?
I tried a few combinations of build environments on my mac to try and solve this issue, but unlitmately did not succeed.
I know unsuccessfully linked OpenMP can lead to this error. Maybe try disabling OpenMP when installing ccl from source.
Not sure if there is a more proper way to do this, but to disable OpenMP, I will just comment out line 66 of CMakeLists.txt.
Any updates on this?