オッサンはDesktopが好き

自作PCや機械学習、自転車のことを脈絡無く書きます

ニューマシンがいきなり起動しなくなったので、再セットアップする

この記事は,下書きでも良いくらい.
ニューマシン(())がいきなり起動しなくなったので,複数回のセットアップを想定して手順を記録します.

0. Ubuntu 18.04 LTS

Japanese ver., is a little inconvenient for the directory name and so on.
Thus, this time I installed English ver.
Note that you have to select Japanese keybourd.

1. NVIDIA Driver

  • check device
lspci | grep -i nvidia
  • check driver currently installed
dpkg -l | grep nvidia  
dpkg -l | grep cuda
  • Remove if an old ver. is installed
sudo apt-get --purge remove nvidia*  
sudo apt-get --purge remove cuda*
sudo apt autoremove
sudo rm /usr/local/cuda
sudo rm -r /urs/local/cuda-*
reboot
  • Install new driver
sudo add-apt-repository ppa:graphics-drivers/ppa  
sudo apt update  
sudo apt-get install nvidia-driver-440  
reboot
  • check installation
nvidia-smi

f:id:changlikesdesktop:20200511143641p:plain:w400

2. CUDA

Note that you have to install CUDA ver. 10.0 for using tensorflow 1.14.0.
Ver. 10.1 is not compatible.

  • check libraries currently installed
dpkg -l | grep cuda
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub  
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb  
sudo apt update  
sudo apt install cuda-toolkit-10-0
reboot
  • edit .bashrc
export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
  • check installation

nvcc -V echo $PATH echo $LD_LIBRARY_PATH

3. cudnn

  • download the following 3 files from official HP libcudnn7_7.4.2.24-1+cuda10.0_amd64.deb
    libcudnn7-dev_7.4.2.24-1+cuda10.0_amd64.deb
    libcudnn7-doc_7.4.2.24-1+cuda10.0_amd64.deb

  • install

sudo dpkg -i libcudnn7_7.4.2.24-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.4.2.24-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7-doc_7.4.2.24-1+cuda10.0_amd64.deb

4. tensorflow

  • install dependant libraries
sudo apt-get update  
sudo apt-get upgrade  
sudo apt-get install python3-pip python3-dev  
sudo apt-get install build-essential cmake git unzip pkg-config  
sudo apt-get install libopenblas-dev liblapack-dev  
sudo apt-get install libhdf5-serial-dev python-h5py  
sudo apt-get install python3-numpy  
sudo apt-get install python3-scipy  
sudo apt-get install python3-matplotlib  
sudo apt-get install ipython3  
sudo apt-get install graphviz  
sudo apt-get install python-opencv  
sudo pip3 install opencv-python  
sudo pip3 install pydot-ng  
  • install tensorflow
sudo pip3 install tensorflow-gpu==1.14.0
pip3 install keras
  • check if GPU works
$ python3  
from tensorflow.python.client import device_lib  
device_lib.list_local_devices()
  • build cuda sample
mkdir ~/CUDA
cp -r /usr/local/cuda-10.0/samples ~/CUDA
cd ~/CUDA/samples
make
cd bin/x86_64/linux/release
./volumeRender

f:id:changlikesdesktop:20200511145531p:plain:w400

5. Japanese

f:id:changlikesdesktop:20200511145205p:plain:w400
click "manage installed languages"

f:id:changlikesdesktop:20200511145342p:plain:w400
click "install"

f:id:changlikesdesktop:20200511145205p:plain:w400
click "+"

f:id:changlikesdesktop:20200511145737p:plain:w400
click "Japanese"

f:id:changlikesdesktop:20200511145608p:plain:w400
selece "Japanese"MOZC"

6. Softwares

vs-code

sudo apt-get install ./code_1.30.0-1544567151_amd64.deb
  • check version
code --version

shutter

sudo add-apt-repository ppa:ubuntuhandbook1/shutter  
sudo apt update  
sudo apt install shutter

meld

  • install using Ubuntu software

7. Libraries for NLP

Beautiful Soup, selenium

pip3 install beautifulsoup4  
pip3 install selenium

Dictionary(mecab-ipadic-NEologd)

  • clone and install
git clone --depth 1 https://github.com/neologd/mecab-ipadic-neologd.git  
cd mecab-ipadic-neologd  
apt install curl  
./bin/install-mecab-ipadic-neologd -n -a
  • edit /etc/mecabrc as:
dicdir = /usr/lib/mecab/dic/mecab-ipadic-neologd

mecab

sudo apt-get install mecab libmecab-dev mecab-ipadic mecab-ipadic-utf8  
pip3 install mecab-python3

wordcloud

pip3 install wordcloud

jumanpp(juman++)

  • install boost
sudo apt install libboost-dev  
sudo apt install libboost-all-dev
  • download and install
cd ~/Downloads
wget http://lotus.kuee.kyoto-u.ac.jp/nl-resource/jumanpp/jumanpp-1.02.tar.xz  
tar xJvf jumanpp-1.02.tar.xz  
cd jumanpp-1.02  
./configure  
make  
sudo make install  
rm -r jumanpp-1.02 (if necessary)
  • check version
jumanpp -v
  • test
echo "すもももももももものうち" | jumanpp
pip3 install pyknp