Anster Charles
Anster Charles

Reputation: 35

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

Upvotes: 1

Views: 5029

Answers (2)

bita azari
bita azari

Reputation: 1

following @merv answer, I resolved it by changing my python version from 3.8 to 3.9

I created another environment as follows: (M1 Mac Big Sur)

  • python : 3.9.7
  • pytorch : 1.9.1
  • pytorch-geometric : 2.0.1

Upvotes: 0

merv
merv

Reputation: 76820

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

Upvotes: 1

Related Questions