question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

`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:open
  • Created 2 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

11reactions
Maria-UETcommented, Apr 27, 2022

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:

image

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

1reaction
j-geutercommented, Nov 9, 2021

Yes, still looking the same:

(env2) 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_scatter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\jonat\Documents\Studium\Masterarbeit\env2\lib\site-packages\torch_scatter\__init__.py", line 13, in <module>
    torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
  File "C:\Users\jonat\Documents\Studium\Masterarbeit\env2\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

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OSError: [WinError 127] The specified procedure could not be ...
My environment: NVIDIA GeForce GTX 1650; Windows 11; Cuda 11.5; Conda 4.10.3; Python 3.8.5; Torch 1.10; Microsoft Visual C++ RedistributableĀ ...
Read more >
Solving WinError of Pytorch Error Loading ...
When running new version of Pytorch with the CUDA 11.3 on Windows 10, I've encountered a strange error message: OSError: [WinError 127] TheĀ ......
Read more >
WinError 126 when import torch - PyTorch Forums
When I import torch, I receive this error: Traceback (most recent call ... OSError: [WinError 126] The specified module could not be found....
Read more >
Cudnn_cnn_train64_8.dll existed but could not be found when ...
OSError : [WinError 127] The specified procedure could not be found. Error loading "C:\Users\haoli\anaconda3\envs\ifcmapping\lib\site-packages\Ā ...
Read more >
DLL load failed: The specified procedure could not be found
I was trying to install pytorch-geometric but when I call import torch_geometric I'm getting the error: ImportError: DLL load failed: TheĀ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found