Open SalvatoreRa opened 1 year ago
Is there any more information available about what's happening? Can you run PyG fine on the command line?
no, I have tried to create a python file
if I write inside, this will not executed
#!/usr/bin/env python3
import torch_geometric
print('Hello World!')
it will return this error:
Erreur de segmentation (core dumped)
while if I comment the importing PyTorch geometric is printing hello world, if I import another library ( like numpy or anything else) it works
Yeah, what I meant by that is that one could add print statements between each import here to see where the segmentation fault actually occurs.
I have tried to import singurlarly:
import torch_geometric.data
import torch_geometric.loader
import torch_geometric.transforms
import torch_geometric.utils
import torch_geometric.profile
each is making die the kernel, which is weird
Yes, this is to be expected since each will call import torch_geometric
first.
Import torch does not problem and I managed before to run a neural network with torch, so I have found weird this behaviour
This could be the same issue I was having here, which is caused by pytorch_lightning
This could be the same issue I was having here, which is caused by
pytorch_lightning
So you solve that editing the Pytorch lightening import?
I would start with trying this command
from pytorch_lightning import LightningDataModule
to see if that causes the kernel to crash. If so, then you can fix the issue by either 1. resolving the pytorch_lightning
compatibility issue (i.e. finding an installation of pytorch_lightning
that doesn't crash) or 2. editing the file mentioned in the other issue to remove pytorch_lightning
from pytorch_geometric
(which may or may not be acceptable, depending on your use case)
Actually, I have no PyTorch lightning:
ModuleNotFoundError: No module named 'pytorch_lightning'
Actually, I have no PyTorch lightning:
ModuleNotFoundError: No module named 'pytorch_lightning'
It's probably a different issue then. Not having pytorch_lightning
installed should be handled gracefully. I guess what I'd recommend then is trying to find out which of the many things imported by pytorch_geometric
causes the fault by adding print
statements, as suggested above
I have tried to add some prints everywhere:
from types import ModuleType
print("ModuleType")
from importlib import import_module
print("import_module")
import torch_geometric.data
print("torch_geometric.data")
import torch_geometric.loader
print("torch_geometric.loader")
import torch_geometric.transforms
print("torch_geometric.transforms")
import torch_geometric.utils
print("torch_geometric.utils")
import torch_geometric.profile
print("torch_geometric.profile")
from .seed import seed_everything
print("seed_everything")
from .home import get_home_dir, set_home_dir
print("get_home_dir, set_home_dir")
from .debug import is_debug_enabled, debug, set_debug
print("is_debug_enabled, debug, set_debug")
from .experimental import (is_experimental_mode_enabled, experimental_mode,
set_experimental_mode)
print("is_experimental_mode_enabled")
which is resulting in this printed:
ModuleType
import_module
Ok - so then I think the next step is to add similar print statements with the pytorch_geometric/data/__init__.py
file and keep following it until you find exactly which import is causing the issue
Ok - so then I think the next step is to add similar print statements with the pytorch_geometric/data/init.py file and keep following it until you find exactly which import is causing the issue
Yeah, it is a bit annoying but that's probably the easiest way to do. You can also just use a debugger instead.
I was having the same issue - debugged through and the issue seems to be inside this line in the initialization of pytorch_geometric/data/data.py
:
from torch_sparse import SparseTensor
Tracing that through the root issue seems to be in torch_sparse
calling torch.ops.load_library(spec.origin)
, where spec.origin is /home/john/.local/lib/python3.10/site-packages/torch_sparse/_version_cuda.so
, and not quite sure how to decode that binary to debug further.
In the end I just downgraded to Python 3.6 and installed via pip instead of conda and the issue didn't seem to persist.
Hi! I Have the same problem: yesterday torch_geometric worked normally. Now my kernel in jupyter dies every time when I import torch_geometric. Is there any solutions of this problem?
Which PyTorch and PyG version are you using? What has changed from yesterday? :)
Can you test to import torch
before importing torch_geometric
?
Sorry for delay,I tried to manage it and gave up.
import torch
works normally (torch 1.13.0, cuda 11.6). That day (that "yesteraday") my server just reloaded
I m facing the same issue while running 'from torch_geometric.datasets import Planetoid'. Before that import torch, torch_geometry was installed successfully and solved the torch-sparse error. But I could not go ahead after running from torch_geometric.datasets import Planetoid, because jupyter kernel crashed and shows OSError: [WinError 127] The specified procedure could not be found. Please help me to find out the solution.
Does import torch_scatter
and import torch_sparse
work normally for you?
Does
import torch_scatter
andimport torch_sparse
work normally for you?
No, they both are not working and giving me the same error. Before that OSError: [WinError 127] The specified procedure could not be found, jupyter kernel crashed and show this message: https://stackoverflow.com/questions/59181708/getting-python-entry-point-not-found-when-trying-to-launch-jupyter-notebook-from, the exact same screenshot error message. After that I have upgrade conda and Anaconda according to that solution. But achieved same error.
Can you also try pip installation?
Can you also try pip installation?
yes, I tried. But this installation failed to solve OS Error. And I could not be able to run/import 'from torch_geometric.datasets import Planetoid'. I could not able to work with Planetoid or any other PyG (torch geometry) dataset. Please help me to find out the solution.
Can you post the full log when running
pip install --verbose torch-scatter torch-sparse -f https://data.pyg.org/...
(env_pytorch) E:\KIGA DATASET\Example_EventLogs\SAP_DEV>pip install --verbose torch-scatter torch-sparse -f https://data.pyg.org/... Using pip 22.3.1 from E:\Tensorprojects\envs\env_pytorch\lib\site-packages\pip (python 3.8) Looking in links: https://data.pyg.org/... Requirement already satisfied: torch-scatter in e:\tensorprojects\envs\env_pytorch\lib\site-packages (2.0.7) Requirement already satisfied: torch-sparse in e:\tensorprojects\envs\env_pytorch\lib\site-packages (0.6.9) Requirement already satisfied: scipy in e:\tensorprojects\envs\env_pytorch\lib\site-packages (from torch-sparse) (1.9.3) Requirement already satisfied: numpy<1.26.0,>=1.18.5 in e:\tensorprojects\envs\env_pytorch\lib\site-packages (from scipy->torch-sparse) (1.23.5)
sorry for the late reply. I got the same OS error message as before. My anaconda env is stored in a different directory and current jupyter notebook file is in a different directory. Is there any problem with that? I have worked on other projects with the different directories and works fine, but while working with this PyG dataset, I am not going ahead.
I think this is totally fine.
Can you first uninstall all the packages and run the same again? The logs are not very meaningful since it just says that requirements are already satisfied.
I uninstalled all the packages and installed them again and at the end tried to install 'torch-sparse with pip install --verbose torch-scatter torch-sparse -f https://data.pyg.org/...', but still while running the 'from torch_geometric.io import read_planetoid_data', the error comes with torch-sparse module not found. The error while installing torch-sparse is below:
(env_pytorch) E:\KIGA DATASET\Example_EventLogs\SAP_DEV>pip install --verbose torch-scatter torch-sparse -f https://data.pyg.org/...
Using pip 22.3.1 from E:\Tensorprojects\envs\env_pytorch\lib\site-packages\pip (python 3.8)
Looking in links: https://data.pyg.org/...
Collecting torch-scatter
Using cached torch_scatter-2.1.0.tar.gz (106 kB)
Running command python setup.py egg_info
running egg_info
creating C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-78w17tot\torch_scatter.egg-info
writing C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-78w17tot\torch_scatter.egg-info\PKG-INFO
writing dependency_links to C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-78w17tot\torch_scatter.egg-info\dependency_links.txt
writing requirements to C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-78w17tot\torch_scatter.egg-info\requires.txt
writing top-level names to C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-78w17tot\torch_scatter.egg-info\top_level.txt
writing manifest file 'C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-78w17tot\torch_scatter.egg-info\SOURCES.txt'
reading manifest file 'C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-78w17tot\torch_scatter.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '' found under directory 'test'
adding license file 'LICENSE'
writing manifest file 'C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-78w17tot\torch_scatter.egg-info\SOURCES.txt'
Preparing metadata (setup.py) ... done
Collecting torch-sparse
Using cached torch_sparse-0.6.15.tar.gz (2.1 MB)
Running command python setup.py egg_info
running egg_info
creating C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-lrnrvfxz\torch_sparse.egg-info
writing C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-lrnrvfxz\torch_sparse.egg-info\PKG-INFO
writing dependency_links to C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-lrnrvfxz\torch_sparse.egg-info\dependency_links.txt
writing requirements to C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-lrnrvfxz\torch_sparse.egg-info\requires.txt
writing top-level names to C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-lrnrvfxz\torch_sparse.egg-info\top_level.txt
writing manifest file 'C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-lrnrvfxz\torch_sparse.egg-info\SOURCES.txt'
reading manifest file 'C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-lrnrvfxz\torch_sparse.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '' found under directory 'test'
adding license file 'LICENSE'
writing manifest file 'C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-lrnrvfxz\torch_sparse.egg-info\SOURCES.txt'
Preparing metadata (setup.py) ... done
Requirement already satisfied: scipy in e:\tensorprojects\envs\env_pytorch\lib\site-packages (from torch-sparse) (1.9.3)
Requirement already satisfied: numpy<1.26.0,>=1.18.5 in e:\tensorprojects\envs\env_pytorch\lib\site-packages (from scipy->torch-sparse) (1.24.0)
Building wheels for collected packages: torch-scatter, torch-sparse
Running command python setup.py bdist_wheel
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-38
creating build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\placeholder.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\scatter.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\segment_coo.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\segment_csr.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\utils.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter__init__.py -> build\lib.win-amd64-cpython-38\torch_scatter
creating build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\std.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite__init__.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
running egg_info
writing torch_scatter.egg-info\PKG-INFO
writing dependency_links to torch_scatter.egg-info\dependency_links.txt
writing requirements to torch_scatter.egg-info\requires.txt
writing top-level names to torch_scatter.egg-info\top_level.txt
reading manifest file 'torch_scatter.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*' found under directory 'test'
adding license file 'LICENSE'
writing manifest file 'torch_scatter.egg-info\SOURCES.txt'
running build_ext
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\utils\cpp_extension.py:358: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
warnings.warn(f'Error checking compiler version for {compiler}: {error}')
building 'torch_scatter._scatter_cpu' extension
creating build\temp.win-amd64-cpython-38
creating build\temp.win-amd64-cpython-38\Release
creating build\temp.win-amd64-cpython-38\Release\csrc
creating build\temp.win-amd64-cpython-38\Release\csrc\cpu
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DWITH_PYTHON -Dtorchscatter_EXPORTS -Icsrc -IE:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include -IE:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\torch\csrc\api\include -IE:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\TH -IE:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\THC -IE:\Tensorprojects\envs\env_pytorch\include -IE:\Tensorprojects\envs\env_pytorch\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt" /EHsc /Tpcsrc\cpu\scatter_cpu.cpp /Fobuild\temp.win-amd64-cpython-38\Release\csrc\cpu\scatter_cpu.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -O3 -DAT_PARALLEL_OPENMP /openmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_scatter_cpu -D_GLIBCXX_USE_CXX11_ABI=0
cl : Command line warning D9002 : ignoring unknown option '-O3'
scatter_cpu.cpp
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\c10/macros/Macros.h(138): warning C4067: unexpected tokens following preprocessor directive - expected a newline
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\c10/util/reverse_iterator.h(92): warning C4814: 'c10::reverse_iterator<_Iterator>::operator =': in C++14 'constexpr' will not imply 'const'; consider explicitly specifying 'const'
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\c10/util/reverse_iterator.h(176): note: see reference to class template instantiation 'c10::reverse_iterator<_Iterator>' being compiled
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\c10/util/reverse_iterator.h(125): warning C4814: 'c10::reverse_iterator<_Iterator>::operator ++': in C++14 'constexpr' will not imply 'const'; consider explicitly specifying 'const'
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\c10/util/reverse_iterator.h(131): warning C4814: 'c10::reverse_iterator<_Iterator>::operator ++': in C++14 'constexpr' will not imply 'const'; consider explicitly specifying 'const'
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\c10/util/reverse_iterator.h(136): warning C4814: 'c10::reverse_iterator<_Iterator>::operator --': in C++14 'constexpr' will not imply 'const'; consider explicitly specifying 'const'
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\c10/util/reverse_iterator.h(142): warning C4814: 'c10::reverse_iterator<_Iterator>::operator --': in C++14 'constexpr' will not imply 'const'; consider explicitly specifying 'const'
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\c10/util/reverse_iterator.h(151): warning C4814: 'c10::reverse_iterator<_Iterator>::operator +=': in C++14 'constexpr' will not imply 'const'; consider explicitly specifying 'const'
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\c10/util/reverse_iterator.h(160): warning C4814: 'c10::reverse_iterator<_Iterator>::operator -=': in C++14 'constexpr' will not imply 'const'; consider explicitly specifying 'const'
E:\Tensorprojects\envs\env_pytorch\lib\site-packages\torch\include\c10/util/string_view.h(88): warning C4814: 'c10::basic_string_view
× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip. full command: 'E:\Tensorprojects\envs\env_pytorch\python.exe' -u -c ' exec(compile('"'"''"'"''"'"'
#
distutils.core
to work with newer packaging standards.sys.argv[0]
to the underlying setup.py
, when invoking setup.py
so-c
. This avoids the following warning:import os, sys, tokenize
try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute setup.py
since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)
file = %r sys.argv[0] = file
if os.path.exists(file):
filename = file
with tokenize.open(file) as f:
setup_py_code = f.read()
else:
filename = "
exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'C:\Users\HP\AppData\Local\Temp\pip-install-kc7ao5gc\torch-scatter_e8d2512063ec4cff9eff6cb8355bcc28\setup.py'"'"',), "
× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip. full command: 'E:\Tensorprojects\envs\env_pytorch\python.exe' -u -c ' exec(compile('"'"''"'"''"'"'
#
distutils.core
to work with newer packaging standards.sys.argv[0]
to the underlying setup.py
, when invoking setup.py
so-c
. This avoids the following warning:import os, sys, tokenize
try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute setup.py
since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)
file = %r sys.argv[0] = file
if os.path.exists(file):
filename = file
with tokenize.open(file) as f:
setup_py_code = f.read()
else:
filename = "
exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'C:\Users\HP\AppData\Local\Temp\pip-install-kc7ao5gc\torch-sparse_e7c9d6355b734cada9391c33c74d765d\setup.py'"'"',), "
× Running setup.py install for torch-scatter did not run successfully. │ exit code: 1 ╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip. full command: 'E:\Tensorprojects\envs\env_pytorch\python.exe' -u -c ' exec(compile('"'"''"'"''"'"'
#
distutils.core
to work with newer packaging standards.sys.argv[0]
to the underlying setup.py
, when invoking setup.py
so-c
. This avoids the following warning:import os, sys, tokenize
try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute setup.py
since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)
file = %r sys.argv[0] = file
if os.path.exists(file):
filename = file
with tokenize.open(file) as f:
setup_py_code = f.read()
else:
filename = "
exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'C:\Users\HP\AppData\Local\Temp\pip-install-kc7ao5gc\torch-scattere8d2512063ec4cff9eff6cb8355bcc28\setup.py'"'"',), "
× Encountered error while trying to install package. ╰─> torch-scatter
note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.
Sorry for the confusion. You need to append the correct suffix to the URL, e.g.
pip install --verbose torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-1.13.0+cpu.html
(depending on your PyTorch/CUDA installation). See the README.md
for more information.
I have tried this too, but got again OSError: [WinError 127] The specified procedure could not be found, jupyter kernel crashed and show this message: https://stackoverflow.com/questions/59181708/getting-python-entry-point-not-found-when-trying-to-launch-jupyter-notebook-from. Is that something like my system does not fulfill this pytorch geometric(CUDA/torch) requirements and torch-sparse module installation requirements?
This happened to me when I'd accidentally used the installation instructions for PyTorch 1.13. when I'd had PyTorch 1.12. installed. I was doing this in a docker container so I just restarted the container to get a clean slate, then did
pip install --upgrade torch
pip show torch
and confirmed that it was 1.13.1, then followed the install instructions again and everything worked
🐛 Describe the bug
Hi everyone,
I have just installed PyTorch geometric in a virtual machine that is Linux Ubuntu, the virtual machine is on a CPU. I used the terminal to just install it and it gave me the message that the
However, when I launch anaconda and I use Jupiter, I just execute this snippet the kernel dies
However, I already use torch and it works ok, and apparently, it is PyTorch geometric that makes crash the kernel
Environment
conda
,pip
, source): Terminaltorch-scatter
):