In this post, I will talk about how to setup your ubuntu machine for Deep Learning projects.
I would recommend you have a fresh downloaded Ubuntu 18.04 OS for this tutorial.
The easiest way to get started with Deep Learning on linux (Ubuntu 18.04) is to install the Anaconda Distribution.
Step 1: Install Anaconda
- Go to https://www.anaconda.com/distribution/
- Download the Anaconda Linux Python 3.7 version (https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh)
- Open terminal and run cd ~/Downloads/
- Run chmod 777 Anaconda3-2019.07-Linux-x86_64.sh
- Run ./Anaconda3-2019.07-Linux-x86_64.sh
- Read through the instructions and all you have to do is continue to press “Enter” until it starts to install
- Wait until the install is complete and restart your terminal screen. Now we have install Anaconda Linux Python 3.7 version
Here is how you can update anaconda in the future:
- To update base conda installation run: conda update conda
- To update conda packages run: conda update anaconda
- To list you packages: conda list
Step 2: Create a virtual environment with the name ‘pytorch’
- Create a virtual env for your pytorch projects: conda create –name pytorch anaconda python=3.7
- To start the env: conda activate pytorch
- To update all the packages in your env: conda update –all
Step 3: Install PyTorch
To install PyTorch via Anaconda, use the following conda command:
- conda install pytorch torchvision -c pytorch
Step 4: Install OpenAI Gym Package
- git clone https://github.com/openai/gym
- cd gym
- pip install -e .
Step 5: To Test it all:
- Open Terminal and run python
- Run the following code:
import torch
print(torch.__version__)
import gym
print(gym.__version__)
If the code is successful and you see the version of both torch and gym, you have successfully installed the software required for Deep Reinforcement Learning Environment on Ubuntu 18.04.