📚
DLIP
  • Introduction
  • Prerequisite
  • Image Processing Basics
    • Notes
      • Thresholding
      • Spatial Filtering
      • Masking with Bitwise Operation
      • Model n Calibration
    • Tutorial
      • Tutorial: Install OpenCV C++
      • Tutorial: Create OpenCV Project
      • Tutorial: C++ basics
      • Tutorial: OpenCV Basics
      • Tutorial: Image Watch for Debugging
      • Tutorial: Spatial Filter
      • Tutorial: Thresholding and Morphology
      • Tutorial: Camera Calibration
      • Tutorial: Color Image Processing
      • Tutorial: Edge Line Circle Detection
      • Tutorial: Corner Detection and Optical Flow
      • Tutorial: OpenCV C++ Cheatsheet
      • Tutorial: Installation for Py OpenCV
      • Tutorial: OpenCv (Python) Basics
    • LAB
      • Lab Report Template
      • Lab Report Grading Criteria
      • LAB Report Instruction
      • LAB: Grayscale Image Segmentation
        • LAB: Grayscale Image Segmentation -Gear
        • LAB: Grayscale Image Segmentation - Bolt and Nut
      • LAB: Color Image Segmentation
        • LAB: Facial Temperature Measurement with IR images
        • LAB: Magic Cloak
      • LAB: Straight Lane Detection and Departure Warning
      • LAB: Dimension Measurement with 2D camera
      • LAB: Tension Detection of Rolling Metal Sheet
  • Deep Learning for Perception
    • Notes
      • Lane Detection with Deep Learning
      • Overview of Deep Learning
        • Object Detection
        • Deep Learning Basics: Introduction
        • Deep Learning State of the Art
        • CNN, Object Detection
      • Perceptron
      • Activation Function
      • Optimization
      • Convolution
      • CNN Overview
      • Evaluation Metric
      • LossFunction Regularization
      • Bias vs Variance
      • BottleNeck Unit
      • Object Detection
      • DL Techniques
        • Technical Strategy by A.Ng
    • Tutorial - PyTorch
      • Tutorial: Install PyTorch
      • Tutorial: Python Numpy
      • Tutorial: PyTorch Tutorial List
      • Tutorial: PyTorch Example Code
      • Tutorial: Tensorboard in Pytorch
      • Tutorial: YOLO in PyTorch
        • Tutorial: Yolov8 in PyTorch
        • Tutorial: Train Yolo v8 with custom dataset
          • Tutorial: Train Yolo v5 with custom dataset
        • Tutorial: Yolov5 in Pytorch (VS code)
        • Tutorial: Yolov3 in Keras
    • LAB
      • Assignment: CNN Classification
      • Assignment: Object Detection
      • LAB: CNN Object Detection 1
      • LAB: CNN Object Detection 2
      • LAB Grading Criteria
    • Tutorial- Keras
      • Train Dataset
      • Train custom dataset
      • Test model
      • LeNet-5 Tutorial
      • AlexNet Tutorial
      • VGG Tutorial
      • ResNet Tutorial
    • Resource
      • Online Lecture
      • Programming tutorial
      • Books
      • Hardware
      • Dataset
      • Useful sites
  • Must Read Papers
    • AlexNet
    • VGG
    • ResNet
    • R-CNN, Fast-RCNN, Faster-RCNN
    • YOLOv1-3
    • Inception
    • MobileNet
    • SSD
    • ShuffleNet
    • Recent Methods
  • DLIP Project
    • Report Template
    • DLIP 2021 Projects
      • Digital Door Lock Control with Face Recognition
      • People Counting with YOLOv4 and DeepSORT
      • Eye Blinking Detection Alarm
      • Helmet-Detection Using YOLO-V5
      • Mask Detection using YOLOv5
      • Parking Space Management
      • Vehicle, Pedestrian Detection with IR Image
      • Drum Playing Detection
      • Turtle neck measurement program using OpenPose
    • DLIP 2022 Projects
      • BakeryCashier
      • Virtual Mouse
      • Sudoku Program with Hand gesture
      • Exercise Posture Assistance System
      • People Counting Embedded System
      • Turtle neck measurement program using OpenPose
    • DLIP Past Projects
  • Installation Guide
    • Installation Guide for Pytorch
      • Installation Guide 2021
    • Anaconda
    • CUDA cuDNN
      • CUDA 10.2
    • OpenCV
      • OpenCV Install and Setup
        • OpenCV 3.4.13 with VS2019
        • OpenCV3.4.7 VS2017
        • MacOS OpenCV C++ in XCode
      • Python OpenCV
      • MATLAB-OpenCV
    • Framework
      • Keras
      • TensorFlow
        • Cheat Sheet
        • Tutorial
      • PyTorch
    • IDE
      • Visual Studio Community
      • Google Codelab
      • Visual Studio Code
        • Python with VS Code
        • Notebook with VS Code
        • C++ with VS Code
      • Jupyter Notebook
        • Install
        • How to use
    • Ubuntu
      • Ubuntu 18.04 Installation
      • Ubuntu Installation using Docker in Win10
      • Ubuntu Troubleshooting
    • ROS
  • Programming
    • Python_Numpy
      • Python Tutorial - Tips
      • Python Tutorial - For Loop
      • Python Tutorial - List Tuple, Dic, Set
    • Markdown
      • Example: API documentation
    • Github
      • Create account
      • Tutorial: Github basic
      • Tutorial: Github Desktop
    • Keras
      • Tutorial Keras
      • Cheat Sheet
    • PyTorch
      • Cheat Sheet
      • Autograd in PyTorch
      • Simple ConvNet
      • MNIST using LeNet
      • Train ConvNet using CIFAR10
  • Resources
    • Useful Resources
    • Github
Powered by GitBook
On this page
  • Installation Guide
  • DLIP 2024-1
  • Part 1. Installing Python Environment
  • Step 1-1. Install Anaconda
  • Step 1-2. Install Python
  • Step 1-3. Install Libraries
  • Part 2. Install Visual Studio Code
  • Part 3. Installing Graphic Card and CUDA
  • Step 3-1. Install GPU Driver, CUDA, cuDNN
  • Part 4. Installing DL Framework
  • Step 4-1. Install Pytorch
  • Step 4-2 Other Option (Tensorflow and Keras)
  • Troubleshooting
  • Q1. GPU not detected in PyTorch
  • Q2. Conda error: Downloaded bytes did not match Content-Length
  • Q3. Conda Error: ClobberError: This has incompatible packages due to a shared path, CondaVerification Error
  • Q4. Build Error in VS Code ( Numpy C-extension failed)

Was this helpful?

  1. Installation Guide

Installation Guide for Pytorch

Installation Guide for Deep Learning 2024

Installation Guide

(updated 2024.4)

This installation guide is for programming deep-learning application using Pytorch

DLIP 2024-1

Make sure you install the correct software version as instructed.

For DLIP 2024 Lecture:

  • Python 3.9, CUDA 11.8, cuDNN 7.6

  • PyTorch 2.0.x

  • Anaconda for Python 3.9 or Anaconda of Latest Version

# Install Anaconda from website

# Update CONDA in Base
conda update -n base -c defaults conda

# Create myEnv=py39
conda create -n py39 python=3.9.12

# Activate myEnv
conda activate py39

# Install Numpy, OpenCV, Matplot, Jupyter
conda install -c anaconda seaborn jupyter
pip install opencv-python

# Check GPU model

# Install NVIDIA Driver from Website

# Install CUDA and cuNN
conda install -c anaconda cudatoolkit=11.8 cudnn 

# Install PyTorch
conda install -c anaconda cudatoolkit=11.8 cudnn seaborn jupyter
conda install pytorch=2.1 torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
pip install torchsummary

# Check Installed Packaged in myENV
conda list all

For DLIP 2022 Lecture:

  • Python 3.9, CUDA 10.2, cuDNN 7.6

  • PyTorch 1.9.1

  • Anaconda for Python 3.9 or Anaconda of Latest Version

for MacOS

(To be Updated)

The installation is divided by two parts

  1. Installing Python Environment

  2. Installing Graphic Card and CUDA

  3. Installing DL Framework (PyTorch, etc)


Part 1. Installing Python Environment

Step 1-1. Install Anaconda

Anaconda : Python and libraries package installer.

Step 1-2. Install Python

Python 3.9 (2022-1)

Python is already installed by installing Anaconda. But, we will make a virtual environment for a specific Python version.

  • Open Anaconda Prompt(admin mode)

  • First, update conda

conda update -n base -c defaults conda
  • Then, Create virtual environment for Python 3.9. Name the $ENV as py39. If you are in base, enter conda activate py39

conda create -n py39 python=3.9.12
  • After installation, activate the newly created environment

conda activate py39

Step 1-3. Install Libraries

Install Numpy, OpenCV, Matplot, Jupyter

conda activate py39
conda install -c anaconda seaborn jupyter
pip install opencv-python

Part 2. Install Visual Studio Code

Also, read about


Part 3. Installing Graphic Card and CUDA

Step 3-1. Install GPU Driver, CUDA, cuDNN

Skip this if you do not have GPU card.

Nvidia GPU driver and Library : To operate the GPU.

  • Graphic Driver - Mandatory installation. Download from NVIDIA website

  • CUDA — GPU library. Stands for Compute Unified Device Architecture.

  • cuDNN — DL primitives library based on CUDA. Stands for CUDA Deep Neural Network.


Part 4. Installing DL Framework

  • TensorFlow — DL library, developed by Google.

  • Keras — DL wrapper with interchangeable backends. Can be used with TensorFlow, Theano or CNTK.

  • PyTorch — Dynamic DL library with GPU acceleration.

Step 4-1. Install Pytorch

Without GPU(Only CPU)

# CPU Only - PyTorch 2.1
conda install pytorch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 cpuonly -c pytorch
pip install opencv-python torchsummary


# CPU Only - PyTorch 1.9
conda install -c anaconda seaborn jupyter
conda install pytorch==1.9.1 torchvision==0.10.1 torchaudio==0.9.1 cpuonly -c pytorch
pip install opencv-python torchsummary

With GPU Change the PyTorch version depending on your CUDA version

For DLIP 2024

# CUDA 11.8
conda activate py39

conda install -c anaconda cudatoolkit=11.8 cudnn seaborn jupyter
conda install pytorch=2.1 torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
pip install opencv-python torchsummary

For DLIP 2022

# CUDA 10.2
conda install -c anaconda cudatoolkit==10.2.89 cudnn seaborn jupyter
conda install pytorch==1.9.1 torchvision==0.10.1 torchaudio==0.9.1 cudatoolkit=10.2 -c pytorch
pip install opencv-python torchsummary

Check the pytorch and torchvision are cuda versions when installing

Check GPU in PyTorch

conda activate py39
python
import torch
torch.__version__
print("cuda" if torch.cuda.is_available() else "cpu")

The result should be cuda as shown.

If your result is,

  • cuda : GOOD, installed normally. You do not need to follow the steps below.

Check Package Versions in Conda

# check all lists
conda list

# check specific program version e.g. pyTorch
conda list | findstr "torch"

Step 4-2 Other Option (Tensorflow and Keras)

  • Run 'Anaconda Prompt(admin)'

  • Activate virtual environment

  • install tensorflow-gpu 2.3.0 packages

  • install keras

conda create -n py37tf23 python=3.7
conda activate py37tf23 
conda install tensorflow-gpu=2.3.0
conda install keras

Troubleshooting

Q1. GPU not detected in PyTorch

SOLUTION 1) Type conda list in the py39 environment

  • check whether cudatoolkit, cudnn are installed

  • check whether pytorch is the cuda version

  • If it is not the same as the figure, re-install. else go to SOLUTION 2

SOLUTION 2) NVIDIA graphics driver update

Q2. Conda error: Downloaded bytes did not match Content-Length

Solution

  • Update Conda in Base: conda update -n base -c defaults conda

  • Clean the conda cache in Base conda clean --all

  • Activate Env: conda activate py39

  • Update Packages: conda update --all

  • Clean conda cache: conda clean --all

  • Then, Install again

Q3. Conda Error: ClobberError: This has incompatible packages due to a shared path, CondaVerification Error

Go to Solution of Q2

If this does not work, then you need to Re-Install the Conda Environment. Then, Update CONDA then create Environment again.

# $myenv = py39

# To keep the environment but remove all packages
conda remove -n myenv --all --keep-env

# To remove all enviromnent
conda remove --all

Q4. Build Error in VS Code ( Numpy C-extension failed)

SOLUTION ) Default Profile Setting in CODE

F1키를 눌러 select default profile을 검색 후 클릭 → command prompt를 선택합니다.

PreviousDLIP Past ProjectsNextInstallation Guide 2021

Last updated 2 months ago

Was this helpful?

Follow:

Follow:

Follow

See here for install instructions of Previous PyTorch Versions

cpu : Go to

You can read more

If the NVIDIA graphics driver is not installed or if it is an older version, the GPU may not be detected. Please refer to the to install Graphic Driver.

How to install Anaconda
How to program Python in VS Code
How to program CoLab(Notebook) in VS Code
How to install Driver, CUDA and cuDNN
PyTorch Previous-Version
about PyTorch installation
Troubleshooting
How to Install VS Code
How to install Driver, CUDA and cuDNN