`OSError: [WinError 127] The specified procedure could not be found` when importing torch_geometric
See original GitHub issueš Bug
I could install torch-geometric via pip install torch-geometric
without errors in my venv. Now when I run import torch_geometric
a window pops up saying āThe procedure entry point could not be located in the dynamic link library ...\env\Lib\site-packages\torch_sparse\_version_cpu.pyd
.ā The complete error message in the terminal reads:
(env) C:\Users\jonat\Documents\Studium\Masterarbeit>py
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch_geometric
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\jonat\Documents\Studium\Masterarbeit\env\lib\site-packages\torch_geometric\__init__.py", line 7, in <module>
import torch_geometric.data
File "C:\Users\jonat\Documents\Studium\Masterarbeit\env\lib\site-packages\torch_geometric\data\__init__.py", line 1, in <module>
from .data import Data
File "C:\Users\jonat\Documents\Studium\Masterarbeit\env\lib\site-packages\torch_geometric\data\data.py", line 3, in <module>
from torch_geometric.typing import OptTensor, NodeType, EdgeType
File "C:\Users\jonat\Documents\Studium\Masterarbeit\env\lib\site-packages\torch_geometric\typing.py", line 4, in <module>
from torch_sparse import SparseTensor
File "C:\Users\jonat\Documents\Studium\Masterarbeit\env\lib\site-packages\torch_sparse\__init__.py", line 15, in <module>
torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
File "C:\Users\jonat\Documents\Studium\Masterarbeit\env\lib\site-packages\torch\_ops.py", line 110, in load_library
ctypes.CDLL(path)
File "C:\Users\jonat\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 127] The specified procedure could not be found
So I also tried it outside the venv and got another error in the terminal (without a window popping up):
C:\Users\jonat\Documents\Studium\Masterarbeit>py
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch_geometric
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\jonat\AppData\Local\Programs\Python\Python39\lib\site-packages\torch_geometric\__init__.py", line 7, in <module>
import torch_geometric.data
File "C:\Users\jonat\AppData\Local\Programs\Python\Python39\lib\site-packages\torch_geometric\data\__init__.py", line 1, in <module>
from .data import Data
File "C:\Users\jonat\AppData\Local\Programs\Python\Python39\lib\site-packages\torch_geometric\data\data.py", line 3, in <module>
from torch_geometric.typing import OptTensor, NodeType, EdgeType
File "C:\Users\jonat\AppData\Local\Programs\Python\Python39\lib\site-packages\torch_geometric\typing.py", line 4, in <module>
from torch_sparse import SparseTensor
File "C:\Users\jonat\AppData\Local\Programs\Python\Python39\lib\site-packages\torch_sparse\__init__.py", line 15, in <module>
torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
AttributeError: 'NoneType' object has no attribute 'origin'
I already read here https://github.com/pyg-team/pytorch_geometric/issues/2304 that *.so
files in ...\torch_sparse
might play a role; there are none in that folder. In most problems I could find about similar bugs, CUDA seems to have been the problem; however, I donāt even use CUDA. Does anyone know what could cause the problem and how I could go about fixing it?
Environment
- OS: Windows 10
- Python version: 3.9.0
- PyTorch version: 1.7.1+cu110
- CUDA/cuDNN version: no CUDA
Issue Analytics
- State:
- Created 2 years ago
- Comments:19 (9 by maintainers)
Top GitHub Comments
I was having the same issue with torch version 1.11.0 when importing torch_geometric datasets
from torch_geometric.datasets import TUDataset
I was able to resolve with by uninstalling torch-geometric and all its dependencies with:
pip uninstall torch-geometric torch-scatter torch-sparse torch-cluster torch-spline-conv
Making sure that torch-geometric is actually uninstalled by checking the packages installed in my anaconda env with:
conda list
Turned out that I had multiple versions of these packages installed in my anaconda environment. The problem was, that I installed torch-geometric with cuda but I actually did not have my gpu connected so I needed to install the cpu version. Installing cpu version did not remove the already installed gpu version, hence creating a conflict.
After removing torch-geometric and all its dependencies, I used the PyG documentation to know which package versions were compatible:
Finally, according to the docs, I used this command:
pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.11.0+cpu.html
The versions of dependencies installed were:
torch-geometric 2.0.4 torch-cluster 1.6.0 torch-scatter 2.0.9 torch-sparse 0.6.13 torch-spline-conv 1.2.1
Yes, still looking the same:
with a window popping up before the error message appears, which again says āThe procedure entry point could not be located in the dynamic link library
...\env\Lib\site-packages\torch_scatter\_version_cpu.pyd
.ā Do you have any other ideas how this could be solved? If not, Iāve been thinking about just implementing some GNNs from scratch now, so you donāt have to spend any more time on this if you donāt feel like we can easily solve it.