pytorch_sparse: osx cpu only version fails with missing native library: symbol not found

https://stackoverflow.com/questions/67455890/pytorch-cpu-only-on-osx-fails-with-symbol-not-found

I am trying to get started with PyTorch - on a mac osx computer. However, basic steps fail:

    from torch_sparse import coalesce, SparseTensor
    
    ---------------------------------------------------------------------------
    OSError                                   Traceback (most recent call last)
    <ipython-input-1-dad8246d5249> in <module>
    ----> 1 from torch_sparse import coalesce, SparseTensor
    
    /usr/local/Caskroom/miniconda/base/envs/my_conda_env/lib/python3.8/site-packages/torch_sparse/__init__.py in <module>
         10         '_saint', '_padding'
         11 ]:
    ---> 12     torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
         13         library, [osp.dirname(__file__)]).origin)
         14 
    
    /usr/local/Caskroom/miniconda/base/envs/my_conda_env/lib/python3.8/site-packages/torch/_ops.py in load_library(self, path)
        102             # static (global) initialization code in order to register custom
        103             # operators with the JIT.
    --> 104             ctypes.CDLL(path)
        105         self.loaded_libraries.add(path)
        106 
    
    /usr/local/Caskroom/miniconda/base/envs/my_conda_env/lib/python3.8/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)
        371 
        372         if handle is None:
    --> 373             self._handle = _dlopen(self._name, mode)
        374         else:
        375             self._handle = handle
    
    OSError: dlopen(/usr/local/Caskroom/miniconda/base/envs/my_conda_env/lib/python3.8/site-packages/torch_sparse/_version.so, 6): Symbol not found: __ZN3c105ErrorC1ENS_14SourceLocationERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE
      Referenced from: /usr/local/Caskroom/miniconda/base/envs/my_conda_env/lib/python3.8/site-packages/torch_sparse/_version.so
      Expected in: flat namespace
     in /usr/local/Caskroom/miniconda/base/envs/my_conda_env/lib/python3.8/site-packages/torch_sparse/_version.so

I am using a conda environment of:

    name: my_conda_env
    channels:
      - pytorch
      - conda-forge
      - defaults
    dependencies:
      - python>=3.8
      - pytorch
      - pytorch_geometric

and instantiated it using:

conda env create --force -f environment.yml

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Yeah – I misspoke. For some reason the pip version of torch doesn’t play well with my debugpy==1.5.1 on macOS (it crashes with code 245). So thinking about it again I don’t think this is a pyg issue at all, sorry about that.

Indeed, https://github.com/conda-forge/pytorch_sparse-feedstock/issues/13 is the problem The manual installation of pytorch geometric and its dependencies such as pytorch sparse using pip https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html is a currently suitable workaround