ImportError: OSError: .../libpyg.so: undefined symbol when I import pyg_lib

Andy_P: <p><code>ImportError: OSError: .../lib/python3.9/site-packages/libpyg.so: undefined symbol: _ZNK5torch8autograd4Node4nameEv when I import pyg_lib</code></p>
<p>Dear community,<br>
I have installed v1.12.0 of PyTorch from source in an Anaconda environment.</p>
<pre><code class="lang-auto">&gt;&gt;&gt; import torch
&gt;&gt;&gt; print(torch.__version__)
1.12.0a0+git67ece03
&gt;&gt;&gt;
&gt;&gt;&gt; print(torch.version.cuda)
11.3
&gt;&gt;&gt; print(torch.cuda.is_available())
True
&gt;&gt;&gt; print(torch.cuda.device_count())
2
</code></pre>
<p>Here is a partial list from <code>conda list</code> :</p>
<pre><code class="lang-auto">$ conda list | grep cud
cudatoolkit               11.6.2              hfc3e2af_12    conda-forge
cudnn                     8.3.2.44             hed8a83a_1    conda-forge

$ conda list | grep torch
# packages in environment at /home/whp/anaconda3/envs/pytorch_compile_pt112cp39:
torch                     1.12.0a0+git67ece03          pypi_0    pypi
torch-scatter             2.1.0+pt112cu116          pypi_0    pypi
</code></pre>
<p>When I import pyg_lib,the following error occurs:</p>
<pre><code class="lang-auto">&gt;&gt;&gt; import pyg_lib
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/myDir/lib/python3.9/site-packages/pyg_lib/__init__.py", line 39, in &lt;module&gt;
    load_library('libpyg')
  File "/myDir/lib/python3.9/site-packages/pyg_lib/__init__.py", line 36, in load_library
    torch.ops.load_library(spec.origin)
  File "/myDir/lib/python3.9/site-packages/torch/_ops.py", line 255, in load_library
    ctypes.CDLL(path)
  File "/myDir/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /myDir/lib/python3.9/site-packages/libpyg.so: undefined symbol: _ZNK5torch8autograd4Node4nameEv
&gt;&gt;&gt;
</code></pre>
<p>When I import torch_scatter,the following error occurs:</p>
<pre><code class="lang-auto">&gt;&gt;&gt; import torch_scatter
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/myDir/lib/python3.9/site-packages/torch_scatter/__init__.py", line 16, in &lt;module&gt;
    torch.ops.load_library(spec.origin)
  File "/myDir/lib/python3.9/site-packages/torch/_ops.py", line 255, in load_library
    ctypes.CDLL(path)
  File "/myDir/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /myDir/lib/python3.9/site-packages/torch_scatter/_version_cuda.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs
&gt;&gt;&gt;

</code></pre>
<p>In another conda environment, I installed PyTorch through binaries：</p>
<pre><code class="lang-auto">conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.3 -c pytorch
</code></pre>
<p>and both packages can be referenced successfully.</p>
<p>What caused these errors?</p>

ptrblck: <p>Your PyG packages might be incompatible with the PyTorch version you have installed or did you check the version compatibility between these libs?</p>

Andy_P: <p>I installed the dependencies of PyG using the wheel.<br>
Below are the versions of the dependencies.</p>
<pre><code class="lang-auto">$ ls
pyg_lib-0.3.1+pt112cu113-cp39-cp39-linux_x86_64.whl        
torch_scatter-2.1.0+pt112cu113-cp39-cp39-linux_x86_64.whl  
torch_spline_conv-1.2.1+pt112cu113-cp39-cp39-linux_x86_64.whl
torch_cluster-1.6.0+pt112cu113-cp39-cp39-linux_x86_64.whl  
torch_sparse-0.6.16+pt112cu113-cp39-cp39-linux_x86_64.whl
</code></pre>
<p>When I installed PyTorch through binaries：</p>
<pre><code class="lang-auto">conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.3 -c pytorch
</code></pre>
<p>These versions of the wheel can be installed and imported successfully.</p>
<p>Is it an issue with the open-source Torch version I downloaded?</p>