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,
第二种:命令行安装 NVIDIA driver
sudo apt purge nvidia-*
to remove old driversudo add-apt-repository ppa:graphics-drivers/ppa
to add repositorysudo apt update && sudo apt upgrade
ubuntu-drivers devices
to see driver versionssudo apt install nvidia-driver-410
to install- restart and check install
nvidia-smi
orwatch -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
orwhich 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 driversudo add-apt-repository ppa:graphics-drivers/ppa
to add repositorysudo apt update && sudo apt upgrade
ubuntu-drivers devices
to see driver versionssudo apt install nvidia-driver-410
to install- restart and check install
nvidia-smi
orwatch -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 usey
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 usenvcc -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
|
Applications(some are in reference)
sougou input
- download sougou for Linux
- Details are in reference.
WPS
- download WPS and install directly
minmize when click
|
vim & Compression software & support exfat
|
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
|
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 bysudo apt-get install python3-distutils