CCL icon indicating copy to clipboard operation
CCL copied to clipboard

ImportError: symbol not found in flat namespace '___kmpc_barrier'

Open 1cosmologist opened this issue 3 years ago • 11 comments

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

1cosmologist avatar Feb 07 '23 08:02 1cosmologist

To clarify, ccl was installed using conda? Is openmp installed in the conda env?

tilmantroester avatar Feb 07 '23 09:02 tilmantroester

Yes, ccl was installed with conda (arm64) distribution. I find llvm-openmp installed in my conda environment.

1cosmologist avatar Feb 07 '23 19:02 1cosmologist

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.

alexander-mead avatar Feb 16 '23 15:02 alexander-mead

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.

tilmantroester avatar Feb 16 '23 17:02 tilmantroester

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.

alexander-mead avatar Feb 16 '23 17:02 alexander-mead

That shouldn't matter I think. And especially not in a conda environment with it's own compilers.

tilmantroester avatar Feb 16 '23 17:02 tilmantroester

@1cosmologist were you able to solve this?

damonge avatar Jul 11 '23 10:07 damonge

I tried a few combinations of build environments on my mac to try and solve this issue, but unlitmately did not succeed.

1cosmologist avatar Jul 11 '23 19:07 1cosmologist

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.

hsinfan1996 avatar Jul 17 '23 07:07 hsinfan1996

Any updates on this?

elisachisari avatar Jul 27 '23 17:07 elisachisari