python-rasters / rasters

Earth science raster processing toolkit for python
Apache License 2.0
2 stars 2 forks source link

`pykdtree` installed with pip on macOS can't find OpenMP #12

Closed gregory-halverson-jpl closed 1 month ago

gregory-halverson-jpl commented 1 month ago
❯ ipython                                                                                                                                                                      (pykdtree) 
Python 3.11.10 | packaged by conda-forge | (main, Sep 10 2024, 10:57:35) [Clang 17.0.6 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.27.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import pykdtree
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File /opt/homebrew/Caskroom/miniforge/base/envs/pykdtree/lib/python3.11/site-packages/pykdtree/__init__.py:4
      3 try:
----> 4     from . import kdtree
      5 except ImportError as err:

ImportError: dlopen(/opt/homebrew/Caskroom/miniforge/base/envs/pykdtree/lib/python3.11/site-packages/pykdtree/kdtree.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '___kmpc_for_static_fini'

The above exception was the direct cause of the following exception:

ImportError                               Traceback (most recent call last)
Cell In[1], line 1
----> 1 import pykdtree

File /opt/homebrew/Caskroom/miniforge/base/envs/pykdtree/lib/python3.11/site-packages/pykdtree/__init__.py:6
      4     from . import kdtree
      5 except ImportError as err:
----> 6     raise ImportError(
      7         "Pykdtree failed to import its C extension. This usually means it "
      8         "was built with OpenMP (C-level parallelization library) support but "
      9         "could not find it on your system. To enable better performance "
     10         "OpenMP must be installed (ex. ``brew install omp`` on Mac with "
     11         "HomeBrew). Otherwise, try installing Pykdtree from source (ex. "
     12         "``pip install --no-binary pykdtree --force-install pykdtree``)."
     13     ) from err

ImportError: Pykdtree failed to import its C extension. This usually means it was built with OpenMP (C-level parallelization library) support but could not find it on your system. To enable better performance OpenMP must be installed (ex. ``brew install omp`` on Mac with HomeBrew). Otherwise, try installing Pykdtree from source (ex. ``pip install --no-binary pykdtree --force-install pykdtree``).

In [2]: 
gregory-halverson-jpl commented 1 month ago

pykdtree is working when installed with mamba:

mamba install pykdtree
gregory-halverson commented 1 month ago

just recommending mamba on macOS for now