Ubuntu18.04 深度学习环境部署(cuda10.0 + pytorch1.1 + tensorflow2.0.0-beta + mxnet)

Ubuntu18.04 with deep learning (cuda10.0 + pytorch1.1 + tensorflow2.0.0-beta + mxnet)

Jul 30, 2020 | deep-learning-tools

1.install Ubuntu18.04 and update source

Update to mirrors.aliyun.com, reference this in step 1.

2.Deep learning environment

这里建议先安装驱动

优先采用第一种方法:

点开软件和更新

选择“Additional Drivers”,从下面的选项选择一个合适的版本 NVIDIA 1080Ti 选择410  Titan V 选435, 

Ubuntu18.04 深度学习环境部署(cuda10.0 + pytorch1.1 + tensorflow2.0.0-beta + mxnet)_第1张图片

第二种:命令行安装 NVIDIA driver

  • sudo apt purge nvidia-* to remove old driver
  • sudo add-apt-repository ppa:graphics-drivers/ppa to add repository
  • sudo apt update && sudo apt upgrade
  • ubuntu-drivers devices to see driver versions
  • sudo apt install nvidia-driver-410 to install
  • restart and check install nvidia-smi or watch -n 0.1 nvidia-smi
  • use sudo apt-mark hold nvidia-driver-410 to prevent graphics drivers from updating automatically
    However, it may be slow and have some problem, you can download nvidia-driver-410.104 or other version, then install follow this reference to install.

Anaconda3.5.2-py36+cuda10.0+cudnn7.5+pytorch1.1+tensorflow2.0-beta+mxnet

Anaconda

  • download Anaconda3-5.2.0-Linux-x86_64 or other version
  • bash Anaconda3-5.2.0-Linux-x86_64.sh
  • enter yes for adding path to .bashrc, no for install vscode
  • source ~/.bashrc
  • use which pip or which python, you will see default pip or python is now in Anaconda.
  • use conda -V to version of Anaconda
  • add conda mirror follow Anaconda 镜像使用帮助
  • update pip source, mkdir ~/.pip && sudo gedit ~/.pip/pip.conf, then add the following in pip.conf
    [global]
    trusted-host=mirrors.aliyun.com
    index-url=https://mirrors.aliyun.com/pypi/simple/
    

NVIDIA driver

  • sudo apt purge nvidia-* to remove old driver
  • sudo add-apt-repository ppa:graphics-drivers/ppa to add repository
  • sudo apt update && sudo apt upgrade
  • ubuntu-drivers devices to see driver versions
  • sudo apt install nvidia-driver-410 to install
  • restart and check install nvidia-smi or watch -n 0.1 nvidia-smi
  • use sudo apt-mark hold nvidia-driver-410 to prevent graphics drivers from updating automatically
    However, it may be slow and have some problem, you can download nvidia-driver-410.104 or other version, then install follow this reference to install.

CUDA

  • download cuda_10.0.130_410.48_linux.run or search for other version
  • sudo sh cuda_10.0.130_410.48_linux.run
  • use q to install directly and pay attention not to install NVIDIA Accelerated Graphics Driver, the other’s can use y or default. Details are in reference.
  • add following use sudo gedit ~/.bashrc

    export CUDA_HOME=/usr/local/cuda 
    export PATH=$PATH:$CUDA_HOME/bin 
    export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    
  • source ~/.bashrc and use nvcc -V to see cuda version

cudnn

  • download cudnn-10.0-linux-x64-v7.5.0.56.solitairetheme8 or other version
  • then
    tar -zxvf cudnn-10.0-linux-x64-v7.5.0.56.solitairetheme8
    sudo cp cuda/include/cudnn.h /usr/local/cuda/include/ 
    sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/ 
    sudo chmod a+r /usr/local/cuda/include/cudnn.h 
    sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
    cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
    

pytorch

  • see https://pytorch.org/get-started/locally/
  • or use downloaded .whl files

    pip install torch-1.1.0-cp36-cp36m-linux_x86_64.whl
    pip install torchvision-0.3.0-cp36-cp36m-linux_x86_64.whl
    
  • test install

     
    In [1]: import torch
    In [2]: torch.__version__
    Out[2]: '1.1.0'
    In [3]: torch.cuda.is_available()
    Out[3]: True
    

 

选装 tensorflow2.0-beta

  • install use pip

    pip install tensorflow==2.0.0-beta0  # cpu
    pip install tensorflow-gpu==2.0.0-beta0  # gpu
    
  • It may have problem ERROR: Cannot uninstall 'wrapt'. Directly use global search to remove related folders and .Egg-info related files. Details are in reference.

  • test install
    In [1]: import tensorflow as tf
    In [2]: tf.__version__
    Out[2]: '2.0.0-beta0'
    In [3]: tf.test.is_gpu_available()
    Out[3]: True
    

选装 mxnet

pip install mxnet-cu100

Applications(some are in reference)

sougou input

  • download sougou for Linux
  • Details are in reference.

WPS

  • download WPS and install directly

minmize when click

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'

vim & Compression software & support exfat

sudo apt install vim
sudo apt install p7zip-full p7zip-rar rar unzip
sudo apt install exfat-fuse exfat-utils

git

  • add your .ssh to your home and init
    sudo apt-get install git
    git config --global user.name ''
    git config --global user.email
    

opencv for python

sudo apt install libopencv-dev
pip install opencv-python

pycharm

  • install in Ubuntu Software
  • or this reference, download pycharm Community version
  • tar -zxvf pycharm-community-{your version}.tar.gz
  • sudo mv pycharm-community-{your version} /opt/
  • sudo gedit /usr/share/applications/pycharm.desktop and add the follows

    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=Pycharm
    Icon=/opt/pycharm-community-2019.1.3/bin/pycharm.png
    Exec=/opt/pycharm-community-2019.1.3/bin/pycharm.sh
    MimeType=application/x-py;
    Name[en_US]=pycharm
    
  • sudo chmod u+x /usr/share/applications/pycharm.desktop

  • It may have problem No module named 'distutils.core', solve it by
    sudo apt-get install python3-distutils

你可能感兴趣的:(ubuntu18.04,深度学习,环境部署,pytorch)