Ubuntu18.04 with deep learning (cuda10.0 + pytorch1.1 + tensorflow2.0.0-beta + mxnet)
1.install Ubuntu18.04 and update source
Update to mirrors.aliyun.com, reference this in step 1.
2.Deep learning environment
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.conf1
2
3[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
1
2
3export 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
1
2
3
4
5
6tar -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
1
2pip install torch-1.1.0-cp36-cp36m-linux_x86_64.whl
pip install torchvision-0.3.0-cp36-cp36m-linux_x86_64.whltest install
1
2
3
4
5In [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
1
2pip install tensorflow==2.0.0-beta0 # cpu
pip install tensorflow-gpu==2.0.0-beta0 # gpuIt 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
1
2
3
4
5In [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
1 | 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
1 | gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize' |
vim & Compression software & support exfat
1 | sudo apt install vim |
git
- add your .ssh to your home and init
1
2
3sudo apt-get install git
git config --global user.name ''
git config --global user.email
opencv for python
1 | sudo apt install libopencv-dev |
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 follows1
2
3
4
5
6
7
8[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]=pycharmsudo 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