Ubuntu server16.04 installation configuration driver 418.87, cuda10.1, cudnn7.6.4.38, anaconda, pytorch ultra-detailed resolved

Ubuntu server16.04 installation configuration driver 418.87, cuda10.1, cudnn7.6.4.38, anaconda, pytorch ultra-detailed resolved

According to this post problem I encountered pro installed to collect summary made specific reference to see the end of the REFERENCE

Installation of GCC

Server Edition is not equipped with gcc, but NVIDIA driver installation requires gcc, tried to change the source, update software library, as well as several methods overstack are not resolved, eventually found the problem can be solved by installing the build-essential package, it will install a bunch of new packages, including gcc, g ++ and make.

sudo apt install build-essential

Install NVIDIA drivers

If you choose to install due to the direct lower installation cuda driver version directly driven, by way of the first load means cuda drive.

1. uninstall the old drivers (not Skip means)

  1. A method, commonsudo apt-get remove –purge nvidia*
  2. Second method, a non-official network drivesudo apt-get remove --purge nvidia(版本全称,如我的nvidia-384.130)
  3. Method three, the official website drive sh ./nvidia.run --uninstall

2. Disable nouveau

Install NVIDIA need to disable the system comes with drivers

  1. open a filesudo gedit /etc/modprobe.d/blacklist.conf

  2. Add at the end of the text

    blacklist nouveau
    option nouveau modeset=0

    Ignoring warn

  3. wq, executionsudo update-initramfs -u

  4. Testing, lsmod | grep nouveauno output instructions to disable success

3. Install the NVIDIA graphics driver

  1. View driver version supported

    sudo apt-cache search nvidia*Usually installed version greater than equal to the maximum fine, I installed 418.87

  2. Download NVIDIA drivers,

    Official website address

  3. Disabling the X server (best to have a spare computer, because this step will be black ... because I was using ssh connections, so no effect on me)

    sudo service lightdm stop

  4. Fu and execute permissions to the file cd to the download directory

    cd ~ 
    sudo chmod a+x NVIDIA-Linux-x86_64-384.130.run
  5. installation

    sudo sh ./NVIDIA-Linux-x86_64-375.20.run –no-opengl-files

  6. Whether detection succeeds nvidia-smi

Installation CUDA10.1

  1. Official website address

  2. Disable X Services (black)

    sudo service lightdm stop

  3. Fu execute permissions to the file and install

    sudo chmod a+x cuda_10.1.243_418.87.00_linux.run
    
    sudo sh cuda_10.1.243_418.87.00_linux.run --override

    accepted, in addition to the drive is not selected, the other choice.

  4. Open the configuration file vim ~/.bashrc, written at the end of

    export PATH=/usr/local/cuda-8.0/bin:$PATH
    export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

    Become effective source ~/.bashrc

  5. Whether detection succeeds nvcc -V

Installation cudnn

  1. Official website to download , and find cudnn cuda version paired to view the official website of the pair , as well as more comprehensive version of the pairing , so my cuda 10.1, cudnn election is 7.6.4

  2. Download add to archive and extract

    # compression
    cp  cudnn-8.0-linux-x64-v5.1.solitairetheme8 good.tgz
    # decompression
    tar -xvf good.tgz
  3. 安装,其实就是改变文件位置和权限

    sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
    $ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/ -d 
    $ sudo chmod a+r /usr/local/cuda/include/cudnn.h
    $ sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
  4. 查看cudnn版本:

    cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2


以上便配置好服务器,以下为非root用户根据需要安装。

我安装的是anaconda、tensorflow、pytorch

安装anaconda

  1. 卸载anaconda(如有) rm-rf ~/anaconda,然后修改配置文件~/.bashrc

  2. 官网下载并安装

  3. 配置文件/home/yourusername/.profile,在最后一行添加如下

    # Anaconda
    export PATH=$PATH:/home/username/anaconda3/bin

    生效 source /home/username/.profile

安装tensorflow

查看官网配对,确定安装版本

# 如果你安装的是 Python 3.6 版的Anaconda:
conda create --name tf_gpu_env tensorflow-gpu # tf_gpu_env是这个环境的名字

# 如果你安装的是 Python 3.7 版的Anaconda,则需要声明新创建的环境使用 Python 3.6:
conda create --name tf_gpu_env python=3.6 anaconda tensorflow-gpu

安装pytorch

  1. 新建虚拟环境并激活环境

    conda create -n pytorch python=3.7
    activate pytroch
  2. 查看官网选择版本,获得代码

    如我的

解决问题:

  1. ERROR: Cannot uninstall 'wrapt'. during upgrade
  2. tensorboard 1.14.0 has requirement setuptools>=41.0.0, but you'll have setuptools 39.1.0

Reference

https://blog.csdn.net/zhang970187013/article/details/81012845

https://www.linuxidc.com/Linux/2019-06/159059.htm

https://blog.csdn.net/Eddy_zheng/article/details/52910249

https://blog.csdn.net/DarrenXf/article/details/82182449

https://blog.csdn.net/qq_41620607/article/details/81236525

https://www.cnblogs.com/onemorepoint/p/7453766.html

https://blog.csdn.net/qq_22474567/article/details/54984257

https://blog.csdn.net/yuejisuo1948/article/details/81043962

https://github.com/tensorflow/tensorflow/issues/30191

https://blog.csdn.net/weixin_44179909/article/details/96973208

https://zhuanlan.zhihu.com/p/59278962

Guess you like

Origin www.cnblogs.com/icodeworld/p/11609747.html