Search code examples
pytorchcondapytorch-geometric

Importing pytorch geometric results in an error message


I'm suddenly unable to import pytorch geometric and I cannot figure out why. I've added a screenshot of the packages in my conda environment and the error message that I get when I try to import torch_geometric.

import torch
import torch.nn.functional as F
from torch_geometric.nn import GCNConv

Error message:

OSError: dlopen(/Users/anstercharles/opt/anaconda3/lib/python3.8/site-packages/torch_sparse/_convert_cpu.so, 6): Symbol not found: __ZN2at8internal13_parallel_runExxxRKNSt3__18functionIFvxxmEEE Referenced from: /Users/anstercharles/opt/anaconda3/lib/python3.8/site-packages/torch_sparse/_convert_cpu.so Expected in: /Users/anstercharles/opt/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_cpu.dylib in /Users/anstercharles/opt/anaconda3/lib/python3.8/site-packages/torch_sparse/_convert_cpu.so

Running:

conda list pytorch

Gives me:

Name Version Build Channel
pytorch 1.9.0 cpu_py38h490fcb8_1 conda-forge
pytorch-cluster 1.5.9 py38_torch_1.9.0_cpu rusty1s
pytorch-geometric 1.7.2 py38_torch_1.9.0_cpu rusty1s
pytorch-scatter 2.0.8 py38_torch_1.9.0_cpu rusty1s
pytorch-sparse 0.6.11 py38_torch_1.9.0_cpu rusty1s
pytorch-spline-conv 1.2.1 py38_torch_1.9.0_cpu rusty1s

I have the packages installed and I was using them just a few minutes ago.


Additional Details

  • OS: MacOS Mojave
  • Anaconda 3
  • Python 3.8

Solution

  • I can replicate the error. The documentation in the README, to use

    conda install pytorch-geometric -c rusty1s -c conda-forge
    

    does not match the order that is actually used in the build, which has the channel order:

    -c defaults -c pytorch -c conda-forge -c rusty1s
    

    Workaround

    I find it works using:

    conda create -n foo -c defaults -c pytorch -c conda-forge -c rusty1s pytorch-geometric