V-antena and Tanimoto's page

谷本の備忘録・雑記帳・work

>

cupy installation on ubuntu18.04 memo

As I had encountered errors when I tried to install cupy, 
 on Ubuntu 18.04

 I upgrade cudnn. Then I succeeded installation of cupy.
 The following is a notes on the procedure.

 1. after uninstallation of existing pip, reinstall pip 

 curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
 python3 get-pip.py --user -vv
 python get-pip.py --user -vv
 install a recent cuda-toolkit 

 2-0. You should insatll nvidia-drivers first. the followings.
 2-1. download the cuda toolkit from 
        https://developer.nvidia.com/cuda-toolkit-archive

 2.2 install cuda-toolkit

 sudo dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
 sudo apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub
 sudo apt-get update
 sudo apt-get install cuda

3.0 install cudnn 
 3-1 download packages for ubuntu18.04 from 
      https://developer.nvidia.com/rdp/cudnn-download

 3-2. install cudnn packages
 sudo dpkg -i libcudnn7_7.3.1.20-1+cuda10.0_amd64.deb
 sudo dpkg -i libcudnn7-dev_7.3.1.20-1+cuda10.0_amd64.deb
 sudo dpkg -i libcudnn7-doc_7.3.1.20-1+cuda10.0_amd64.deb

 3-3. replace the old cuda path with cuda-10.0 path
 nano ~/.bashrc
 NVIDIA CUDA Toolkit
 export PATH=/usr/local/cuda-10.0/bin:$PATH
 export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH
 source ~/.bashrc
 echo $PATH |grep cuda
 install cupy 
 pip3 install --user cupy
 python3
   import cupy
   import cupy.cudnn
 failed. 
    modulenotfounderror: no module named 'cupy.cudnn' 
 so I did the following

 4.0 pip3 uninstall cupy

 set $CUDA_PATH as /usr/local/cuda
 pip3 -v install --user cupy --no-cache-dir
 python3
   import cupy
   import cupy.cudnn

 No error.

 additional
 sudo cp /usr/local/cuda/include/cuda_fp16.hpp /usr/include
 sudo cp /usr/local/cuda/include/cuda_fp16.h   /usr/include

Leave a Comment

入力エリアすべてが必須項目です。メールアドレスが公開されることはありません。

内容をご確認の上、送信してください。