simple-faster-rcnn-pytorch icon indicating copy to clipboard operation
simple-faster-rcnn-pytorch copied to clipboard

ImportError: CuPy is not correctly installed.

Open woxihuanchirou opened this issue 6 years ago • 7 comments

When I run python3 train.py train --env='fasterrcnn_caffe' --plot_every=100 --caffe_pretrain,an error occured like this:

Traceback (most recent call last):
  File "/home/htu/anaconda3/lib/python3.6/site-packages/cupy/__init__.py", line 11, in <module>
    from cupy import core  # NOQA
  File "/home/htu/anaconda3/lib/python3.6/site-packages/cupy/core/__init__.py", line 1, in <module>
    from cupy.core import core  # NOQA
ImportError: libcuda.so.1: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train.py", line 9, in <module>
    from model import FasterRCNNVGG16
  File "/home/htu/yc/simple-faster-rcnn-pytorch-master/model/__init__.py", line 1, in <module>
    from .faster_rcnn_vgg16 import FasterRCNNVGG16
  File "/home/htu/yc/simple-faster-rcnn-pytorch-master/model/faster_rcnn_vgg16.py", line 4, in <module>
    from model.region_proposal_network import RegionProposalNetwork
  File "/home/htu/yc/simple-faster-rcnn-pytorch-master/model/region_proposal_network.py", line 7, in <module>
    from model.utils.creator_tool import ProposalCreator
  File "/home/htu/yc/simple-faster-rcnn-pytorch-master/model/utils/creator_tool.py", line 2, in <module>
    import cupy as cp
  File "/home/htu/anaconda3/lib/python3.6/site-packages/cupy/__init__.py", line 32, in <module>
    six.reraise(ImportError, ImportError(msg), exc_info[2])
  File "/home/htu/anaconda3/lib/python3.6/site-packages/six.py", line 692, in reraise
    raise value.with_traceback(tb)
  File "/home/htu/anaconda3/lib/python3.6/site-packages/cupy/__init__.py", line 11, in <module>
    from cupy import core  # NOQA
  File "/home/htu/anaconda3/lib/python3.6/site-packages/cupy/core/__init__.py", line 1, in <module>
    from cupy.core import core  # NOQA
ImportError: CuPy is not correctly installed.

If you are using wheel distribution (cupy-cudaXX), make sure that the version of CuPy you installed matches with the version of CUDA on your host.
Also, confirm that only one CuPy package is installed:
  $ pip freeze

If you are building CuPy from source, please check your environment, uninstall CuPy and reinstall it with:
  $ pip install cupy --no-cache-dir -vvvv

Check the Installation Guide for details:
  https://docs-cupy.chainer.org/en/latest/install.html

original error: libcuda.so.1: cannot open shared object file: No such file or directory

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

python 3.6.4 cupy-cuda80 4.0.0 Cython 0.27.3 torch 0.4.0 cuda 8.0 cudnn v5.1 The version of cupy I installed matches with the version of CUDA.Why this error occured?

woxihuanchirou avatar May 12 '18 14:05 woxihuanchirou

I had the same error and I first change the Edit > Notebook settings > Hardware accelerator: [GPU]. After that, I followedd the steps:

>>> !apt -y install libcusparse8.0 libnvrtc8.0 libnvtoolsext1
>>> !ln -snf /usr/lib/x86_64-linux-gnu/libnvrtc-builtins.so.8.0 /usr/lib/x86_64-linux-gnu/libnvrtc-builtins.so
>>> !pip install cupy-cuda80 chainer

et voila!

>>> import cupy as cp

iarroyof avatar Aug 29 '18 17:08 iarroyof

i have some problem,are you solve it?

air-y avatar Jan 20 '19 16:01 air-y

the version of CuPy you installed matches with the version of CUDA on your host. the version of CUDA on my host is cuda9.1 so I should pip install cupy-cuda91

tikboaHIT avatar Mar 11 '19 02:03 tikboaHIT

the version of CuPy you installed matches with the version of CUDA on your host. the version of CUDA on my host is cuda9.1 so I should pip install cupy-cuda91

cuda9.0 , when install use :pip install cupy-90 , it will error!

feixiangdekaka avatar Apr 17 '19 03:04 feixiangdekaka

you may sovel this error as list:open PyCharm--Edit Configuration---Environment Variables;add two loads: LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/local/cuda9.0/extras/CUPTI/lib64:$LD_LIBRARY_PATH CUDA_HOME=/usr/local/cuda-9.0/ (ps:this is cuda9.0,you need to change)

XGuider avatar Aug 08 '19 03:08 XGuider

i have solved the problem ,my cuda is 10.2,i try install cupy-cuda102 is failed,when i use conda install -c anaconda cupy is solved my problem.

blackAndrechen avatar Mar 02 '20 11:03 blackAndrechen

i have solved the problem ,my cuda is 10.2,i try install cupy-cuda102 is failed,when i use conda install -c anaconda cupy is solved my problem.

thx, this solves my problem.

alualu628628 avatar Aug 28 '21 12:08 alualu628628