pip does not find the cudatoolkit that conda has installed
I'm trying to install torch_scatter with pip. However it gives me an error message:
      File &quot;/home1/huangjiawei/miniconda3/envs/lin/lib/python3.8/site-packages/torch/utils/cpp_extension.py&quot;, line 404, in build_extensions
        self._check_cuda_version()
      File &quot;/home1/huangjiawei/miniconda3/envs/lin/lib/python3.8/site-packages/torch/utils/cpp_extension.py&quot;, line 781, in _check_cuda_version
        raise RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda))
    RuntimeError:
    The detected CUDA version (9.0) mismatches the version that was used to compile
    PyTorch (11.3). Please make sure to use the same CUDA versions.

But i did install cudatoolkit by conda:
(lin) huangjiawei@ai-server-2:~/linzhijie_Weakly-supervised-Query-based-Video-Segmentation$ conda list|grep cuda
cudatoolkit               11.3.1               h2bc3f7f_2    defaults
pytorch                   1.10.2          py3.8_cuda11.3_cudnn8.2.0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
pytorch-mutex             1.0                        cuda    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch

So it seems that pip only detected the cuda version of the sever,but didn't detected the cuda version in my enviroment.
How to fix it?

This error is complaining that your system CUDA compiler (nvcc) version doesn't match. cudatoolkit you installed in conda is CUDA runtime. These two are different components.
To install CUDA compiler, you need to install the CUDA toolkit from NVIDIA
