question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fatal error: cusparse.h: No such file or directory

See original GitHub issue

🐛 Bug

When I run the command: python setup.py build develop, it has fatal error:

In file included from /home/ubuntu/yuan/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.cu:3:0:
/home/ubuntu/.conda/envs/pt10/lib/python3.6/site-packages/torch/include/ATen/cuda/CUDAContext.h:12:22: fatal error: cusparse.h: No such file or directory
compilation terminated.
error: command '/usr/local/cuda-9.0/bin/nvcc' failed with exit status 1

And I also check the enviroment:

(pt10) ubuntu@dgx1-84-1:~/yuan/maskrcnn-benchmark$ conda list
# packages in environment at /home/ubuntu/.conda/envs/pt10:
#
# Name                    Version                   Build  Channel
blas                      1.0                         mkl  
ca-certificates           2019.1.23                     0  
certifi                   2019.3.9                 py36_0  
cffi                      1.12.2           py36h2e261b9_1  
cudatoolkit               9.0                  h13b8566_0  
cycler                    0.10.0                    <pip>
Cython                    0.29.7                    <pip>
intel-openmp              2019.3                      199  
kiwisolver                1.0.1                     <pip>
libedit                   3.1.20181209         hc058e9b_0  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 8.2.0                hdf63c60_1  
libgfortran-ng            7.3.0                hdf63c60_0  
libstdcxx-ng              8.2.0                hdf63c60_1  
matplotlib                3.0.3                     <pip>
mkl                       2019.3                      199  
mkl_fft                   1.0.10           py36ha843d7b_0  
mkl_random                1.0.2            py36hd81dba3_0  
ncurses                   6.1                  he6710b0_1  
ninja                     1.9.0                     <pip>
ninja                     1.9.0            py36hfd86e86_0  
numpy                     1.16.2                    <pip>
numpy                     1.16.2           py36h7e9f1db_0  
numpy-base                1.16.2           py36hde5b4d6_0  
openssl                   1.1.1b               h7b6447c_1  
pip                       19.0.3                   py36_0  
pycocotools               2.0.0                     <pip>
pycparser                 2.19                     py36_0  
pyparsing                 2.4.0                     <pip>
python                    3.6.8                h0371630_0  
python-dateutil           2.8.0                     <pip>
pytorch-nightly           1.1.0.dev20190417 py3.6_cuda9.0.176_cudnn7.4.2_0    pytorch
PyYAML                    5.1                       <pip>
readline                  7.0                  h7b6447c_5  
setuptools                41.0.0                   py36_0  
six                       1.12.0                    <pip>
sqlite                    3.27.2               h7b6447c_0  
tk                        8.6.8                hbc83047_0  
tqdm                      4.31.1                    <pip>
wheel                     0.33.1                   py36_0  
xz                        5.2.4                h14c3975_4  
yacs                      0.1.6                     <pip>
zlib                      1.2.11               h7b6447c_3  

I also check the gcc version:

(pt10) ubuntu@dgx1-84-1:~/yuan/maskrcnn-benchmark$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I don’t know how to deal with it. What should I do now?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

22reactions
ImJustAskingDudecommented, Mar 7, 2020

Hey,

I have struggled with the same issue, and the solution is really simple: apt-get install cuda-cusparse-dev-XX-X For me it was: apt-get install cuda-cusparse-dev-10-1

-dev is the package that contains cusparse.h

For further reference, here is where I’ve found it: http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/

Hope this helps

5reactions
vikiQiucommented, Aug 2, 2019

I got the same problem.

In file included from /xxx/awesome-semantic-segmentation-pytorch/core/nn/csrc/cuda/syncbn_cuda.cu:5:0:
/usr/local/lib/python3.5/dist-packages/torch/lib/include/ATen/cuda/CUDAContext.h:12:22: fatal error: cusparse.h: No such file or directory
compilation terminated.
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1

It’s caused by missing the cusparse.h in cuda directory. I get into the directory /user/local/ and find 2 cuda directory: cuda and cuda-9.0. I move the directory cuda into another directory. The problem is then solved, for it use the right command ‘/usr/local/cuda-9.0/bin/nvcc’.

Read more comments on GitHub >

github_iconTop Results From Across the Web

fatal error: cusparse.h: No such file or directory compilation ...
写在前面: 我是用pycharm远程连接矩池云的GPU遇到了这个问题。前面安装包都很顺利,就是最后安装maskrcnn-benchmark的时候出问题了,一直在报错
Read more >
cusparse.h: No such file or directory compilation terminated.
fatal error : zmq.hpp: No such file or directory compilation terminated. ZeroMQ zeromq. 找不到zmq.hpp的原因是,zmq.hpp只存在master中。 如果你 ...
Read more >
cuSPARSE - NVIDIA Documentation Center
Using different versions of the cusparse.h header file and the shared library ... This is usually caused by the lack of a prior...
Read more >
File CUDAContext.h — PyTorch master documentation
h. ↰ Parent directory ( aten/src/ATen/cuda ). Page Contents. Definition ( ...
Read more >
GhostNet - a Hugging Face Space by pytorch
Build error. App Files Files and versions Community. Linked models. build error ... fatal error: cublas_v2.h: No such file or directory #include ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found