Want to install : torch-sparse, getting this error

I am getting this error traceback, already installed torch_geometric.

please guide

>>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>=1.14.5 in c:\users\krishna\anaconda3\lib\site-packages (from scipy->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 -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\bandwidth.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\cat.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\coalesce.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\convert.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\diag.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\eye.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\index_select.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\masked_select.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\matmul.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\metis.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\mul.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\narrow.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\padding.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\permute.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\reduce.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\rw.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\saint.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\sample.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\select.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\spadd.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\spmm.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\spspmm.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\storage.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\tensor.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\transpose.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\utils.py -> build\lib.win-amd64-3.8\torch_sparse
  copying torch_sparse\__init__.py -> 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 -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\bandwidth.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\cat.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\coalesce.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\convert.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\diag.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\eye.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\index_select.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\masked_select.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\matmul.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\metis.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\mul.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\narrow.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\padding.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\permute.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\reduce.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\rw.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\saint.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\sample.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\select.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\spadd.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\spmm.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\spspmm.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\storage.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\tensor.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\transpose.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\utils.py -> build\lib.win-amd64-3.8\torch_sparse
    copying torch_sparse\__init__.py -> 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.

Torch version is ‘1.8.0’
torch.version.cuda----10.2

It seems your compiler might be too old:

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/

Thanks for reply,
However I am not getting whether any updates will help as per your comment?
or I cant do anything with this device.
also will google colab help?

Or finally using CPU would help?

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”.

I don’t know which device you are referring to.
Your current issue is that a CPU source build fails due to the lack of a proper C++ toolchain on your Windows system.

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.

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.

If you get stuck you could also try to just install the binaries instead of trying to build from source, which should be easier.