/Ubuntu-for-Deep-Learning

Useful notes about Ubuntu (especially for Deep Learning code developers)

Ubuntu-for-Deep-Learning

Useful notes about Ubuntu (especially for Deep Learning code developers)

Logo

General useful links:

Other important & useful links:

Package Management Notes in Ubuntu:

Python Virtual Environments:

Managing Python Version Dependencies:

Docker:

Set & Change DNS on Ubuntu Server:

Install deep learning packages:

Install PyTorch 0.3.1 (for python 3.5 & CUDA 9.0):

  • Type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type pip3 install --upgrade http://download.pytorch.org/whl/cu90/torch-0.3.1-cp35-cp35m-linux_x86_64.whl
  • Type pip3 install --upgrade torchvision

Install TensorFlow 1.7 GPU based (for python 3.5 & CUDA 9.0 & cuDNN 7.0.5):

  • First download its whl file via the below command:
  • wget https://files.pythonhosted.org/packages/e3/e8/9496b0663fef0415094a598deb1099aaa2a69f2bc9d924cafd05677d3c85/tensorflow_gpu-1.7.0-cp35-cp35m-manylinux1_x86_64.whl
  • Then type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type pip3 install --upgrade YourDownloadedAddress/tensorflow_gpu-1.7.0-cp35-cp35m-manylinux1_x86_64.whl
  • Note that in the above command the YourDownloadedAddress is the address of whl file (e.g., /home/smith/Programs)

Install MXNet 1.2.0 (for python 3.5 & CUDA 9.0):

  • Type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type pip3 install --upgrade mxnet-cu90 --pre

Install Keras 2.2.0 (for python 3.5 & CUDA 9.0 & cuDNN 7.0.5 & TensorFlow Backend):

  • Type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type pip3 install --upgrade keras

Install 2 Different Versions of a package (e.g., PyTorch) on a Single System:

Suppose one wants to install 2 different versions of a deep learning package (e.g., PyTorch) on a single system. We assume that the PyTorch 0.3.1 has been installed via pip3. Now we want to install PyTorch 0.4.0 (i.e., we want to have both versions on a signle system). To this end, follow below instructions:

  • 1- sudo mkdir /opt/pytorch4
  • 2- sudo chown -R username:username /opt/pytorch4 (Note: instead of username you must type your username (e.g., smith))
  • 3- Download the *.whl file of PyTorch 0.4.0 from its Pip3 Repository
  • 4- Extract it
  • 5- Copy all of the extracted files into "/opt/pytorch4"
  • 6- When run Python3 the type:
import sys
sys.path.insert(0, "/opt/pytorch4/")
import torch
print(torch.__version__) 
  • 7- Note: If you don't type the above commands, then the default version of PyTorch (i.e., the previous installed it via pip3 (0.3.1 version)) is worked.

Install required packages:

Install pip3 on ubuntu:

  • Type sudo apt-get update
  • Type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type apt install python3-pip
  • After install pip3 then upgrade it via the below command:
  • pip3 install --upgrade setuptools pip

Install opencv-python:

  • Type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type pip3 install --upgrade opencv-python

Install opencv-contrib-python:

  • Type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type pip3 install --upgrade opencv-contrib-python

Install Dlib:

  • sudo apt-get install build-essential cmake
  • sudo apt-get install libgtk-3-dev
  • sudo apt-get install libboost-all-dev
  • sudo su
  • pip3 install dlib

Install Pillow:

  • Type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type pip3 install --upgrade Pillow

Install scikit-learn:

  • Type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type pip3 install --upgrade -U scikit-learn

Install h5py:

  • Type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type pip3 install --upgrade h5py

Install Jupyter Notebook:

  • Type sudo su in ubuntu terminal
  • After inserting your ubuntu's password, then type pip3 install --upgrade jupyter

Install OpenCV in Ubuntu for C++:

Other Useful Notes:

Open New Terminal:

  • Ctrl + Alt + T that opened a terminal window.
  • Ctrl + Shift + T that opened a new tab in a terminal.

Show the CUDA Installed version:

  • sudo apt show cuda

Show the CuDNN Installed version:

  • apt search cudnn