table of Contents
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)
- A method, common
sudo apt-get remove –purge nvidia*
- Second method, a non-official network drive
sudo apt-get remove --purge nvidia(版本全称,如我的nvidia-384.130)
- Method three, the official website drive
sh ./nvidia.run --uninstall
2. Disable nouveau
Install NVIDIA need to disable the system comes with drivers
open a file
sudo gedit /etc/modprobe.d/blacklist.conf
Add at the end of the text
blacklist nouveau option nouveau modeset=0
Ignoring warn
wq, execution
sudo update-initramfs -u
Testing,
lsmod | grep nouveau
no output instructions to disable success
3. Install the NVIDIA graphics driver
View driver version supported
sudo apt-cache search nvidia*
Usually installed version greater than equal to the maximum fine, I installed 418.87Download NVIDIA drivers,
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
Fu and execute permissions to the file cd to the download directory
cd ~ sudo chmod a+x NVIDIA-Linux-x86_64-384.130.run
installation
sudo sh ./NVIDIA-Linux-x86_64-375.20.run –no-opengl-files
Whether detection succeeds
nvidia-smi
Installation CUDA10.1
Disable X Services (black)
sudo service lightdm stop
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.
Open the configuration file
vim ~/.bashrc
, written at the end ofexport PATH=/usr/local/cuda-8.0/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
Become effective
source ~/.bashrc
Whether detection succeeds
nvcc -V
Installation cudnn
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
Download add to archive and extract
# compression cp cudnn-8.0-linux-x64-v5.1.solitairetheme8 good.tgz # decompression tar -xvf good.tgz
安装,其实就是改变文件位置和权限
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*
查看cudnn版本:
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
以上便配置好服务器,以下为非root用户根据需要安装。
我安装的是anaconda、tensorflow、pytorch
安装anaconda
卸载anaconda(如有)
rm-rf ~/anaconda
,然后修改配置文件~/.bashrc
官网下载并安装
配置文件/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
新建虚拟环境并激活环境
conda create -n pytorch python=3.7 activate pytroch
查看官网选择版本,获得代码
如我的
解决问题:
- ERROR: Cannot uninstall 'wrapt'. during upgrade
- 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