Want to install : torch-sparse, getting this error

krishna511: <p>I am getting this error traceback, already installed torch_geometric.</p>
<p>please guide</p>
<pre><code class="lang-auto">&gt;&gt;pip install torch-sparse
Collecting torch-sparse
  Downloading torch_sparse-0.6.14.tar.gz (51 kB)
Requirement already satisfied: scipy in c:\users\krishna\anaconda3\lib\site-packages (from torch-sparse) (1.5.2)
Requirement already satisfied: numpy&gt;=1.14.5 in c:\users\krishna\anaconda3\lib\site-packages (from scipy-&gt;torch-sparse) (1.19.2)
Note: you may need to restart the kernel to use updated packages.
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\krishna\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\krishna\\AppData\\Local\\Temp\\pip-install-0856mrlx\\torch-sparse\\setup.py'"'"'; __file__='"'"'C:\\Users\\krishna\\AppData\\Local\\Temp\\pip-install-0856mrlx\\torch-sparse\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\krishna\AppData\Local\Temp\pip-wheel-irxeugho'
       cwd: C:\Users\krishna\AppData\Local\Temp\pip-install-0856mrlx\torch-sparse\
  Complete output (53 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\add.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\bandwidth.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\cat.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\coalesce.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\convert.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\diag.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\eye.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\index_select.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\masked_select.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\matmul.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\metis.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\mul.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\narrow.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\padding.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\permute.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\reduce.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\rw.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\saint.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\sample.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\select.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\spadd.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\spmm.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\spspmm.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\storage.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\tensor.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\transpose.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\utils.py -&gt; build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\__init__.py -&gt; build\lib.win-amd64-3.8\torch_sparse
Building wheels for collected packages: torch-sparse
  Building wheel for torch-sparse (setup.py): started
  Building wheel for torch-sparse (setup.py): finished with status 'error'
  Running setup.py clean for torch-sparse
Failed to build torch-sparse
Installing collected packages: torch-sparse
    Running setup.py install for torch-sparse: started
    Running setup.py install for torch-sparse: finished with status 'error'
  running egg_info
  writing torch_sparse.egg-info\PKG-INFO
  writing dependency_links to torch_sparse.egg-info\dependency_links.txt
  writing requirements to torch_sparse.egg-info\requires.txt
  writing top-level names to torch_sparse.egg-info\top_level.txt
  reading manifest file 'torch_sparse.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*' found under directory 'test'
  writing manifest file 'torch_sparse.egg-info\SOURCES.txt'
  running build_ext
  C:\Users\krishna\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py:304: 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_sparse._convert_cpu' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  Error in atexit._run_exitfuncs:
  Traceback (most recent call last):
    File "C:\Users\krishna\Anaconda3\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
      return stream.closed
  ValueError: underlying buffer has been detached
  ----------------------------------------
  ERROR: Failed building wheel for torch-sparse
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\krishna\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\krishna\\AppData\\Local\\Temp\\pip-install-0856mrlx\\torch-sparse\\setup.py'"'"'; __file__='"'"'C:\\Users\\krishna\\AppData\\Local\\Temp\\pip-install-0856mrlx\\torch-sparse\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\krishna\AppData\Local\Temp\pip-record-_96g2bap\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\krishna\Anaconda3\Include\torch-sparse'
         cwd: C:\Users\krishna\AppData\Local\Temp\pip-install-0856mrlx\torch-sparse\
    Complete output (53 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\add.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\bandwidth.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\cat.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\coalesce.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\convert.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\diag.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\eye.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\index_select.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\masked_select.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\matmul.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\metis.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\mul.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\narrow.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\padding.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\permute.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\reduce.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\rw.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\saint.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\sample.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\select.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\spadd.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\spmm.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\spspmm.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\storage.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\tensor.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\transpose.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\utils.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\__init__.py -&gt; build\lib.win-amd64-3.8\torch_sparse
    running egg_info
    writing torch_sparse.egg-info\PKG-INFO
    writing dependency_links to torch_sparse.egg-info\dependency_links.txt
    writing requirements to torch_sparse.egg-info\requires.txt
    writing top-level names to torch_sparse.egg-info\top_level.txt
    reading manifest file 'torch_sparse.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files matching '*' found under directory 'test'
    writing manifest file 'torch_sparse.egg-info\SOURCES.txt'
    running build_ext
    C:\Users\krishna\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py:304: 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_sparse._convert_cpu' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    Error in atexit._run_exitfuncs:
    Traceback (most recent call last):
      File "C:\Users\krishna\Anaconda3\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
        return stream.closed
    ValueError: underlying buffer has been detached
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\krishna\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\krishna\\AppData\\Local\\Temp\\pip-install-0856mrlx\\torch-sparse\\setup.py'"'"'; __file__='"'"'C:\\Users\\krishna\\AppData\\Local\\Temp\\pip-install-0856mrlx\\torch-sparse\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\krishna\AppData\Local\Temp\pip-record-_96g2bap\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\krishna\Anaconda3\Include\torch-sparse' Check the logs for full command output.
</code></pre>

krishna511: <p>Torch version is ‘1.8.0’<br>
torch.version.cuda----10.2</p>

ptrblck: <p>It seems your compiler might be too old:</p>
<pre><code class="lang-auto">error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
</code></pre>

krishna511: <p>Thanks for reply,<br>
However I am not getting whether any updates will help as per your comment?<br>
or I cant do anything with this device.<br>
also will google colab help?</p>
<p>Or finally using CPU would help?</p>

ptrblck: <aside class="quote no-group" data-username="krishna511" data-post="4" data-topic="157315">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/krishna511/48/30486_2.png" class="avatar"> krishna511:</div>
<blockquote>
<p>However I am not getting whether any updates will help as per your comment?</p>
</blockquote>
</aside>
<p>The error explains that “Microsoft Visual C++ 14.0 or greater is required” so if you want to build from source, you would need to install “Microsoft Visual C++ 14.0 or greater”.</p>
<aside class="quote no-group" data-username="krishna511" data-post="4" data-topic="157315">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/krishna511/48/30486_2.png" class="avatar"> krishna511:</div>
<blockquote>
<p>or I cant do anything with this device.</p>
</blockquote>
</aside>
<p>I don’t know which device you are referring to.<br>
Your current issue is that a CPU source build fails due to the lack of a proper C++ toolchain on your Windows system.</p>
<aside class="quote no-group" data-username="krishna511" data-post="4" data-topic="157315">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/krishna511/48/30486_2.png" class="avatar"> krishna511:</div>
<blockquote>
<p>also will google colab help?</p>
</blockquote>
</aside>
<p>I also don’t know how this is related to your source build, but you could certainly check if Colab notebooks are able to build these packages from source.</p>
<aside class="quote no-group" data-username="krishna511" data-post="4" data-topic="157315">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/krishna511/48/30486_2.png" class="avatar"> krishna511:</div>
<blockquote>
<p>Or finally using CPU would help?</p>
</blockquote>
</aside>
<p>You are already trying to build a CPU binary as nothing indicates any CUDA compiler in the build logs and the error points to the C++ compiler.</p>
<p>If you get stuck you could also try to just install the binaries instead of trying to build from source, which should be easier.</p>