How to install Flask on Ubuntu 18.04/19.04

How to install Flask – Python web development micro framework on Ubuntu 18.04 and 19.04

Go ahead and launch your terminal, run the following commands..

sudo apt update && upgrade

I assume that you already have python and pip installed on your Ubuntu Desktop/server. If not, you can install python3 and pip3 with the following commands.

Let’s Install python3 and pip3

sudo apt install python3
sudo apt install python3-pip

Now, let’s check python3 and pip3 version

python3 -V
pip3 -V

Install python virtual environment

We’ll create a directory/folder, where python virtual enviroment will be installed and activated.

cd Desktop && mkdir pybox && cd pybox

We just created a directory on the Desktop and changed directory, now, we are in pybox directory.

Let’s install venv and name it venv

python3 -m venv venv

Let’s activate the venv – The Python environment

source venv/bin/activate

Make sure you are in pybox direcetory, before start activating python virtual envorinment

Let’s install Flask

pip install flask
flask --version
pip lists

Let’s quickly create flask app

Create a folder/directory in the pybox directory/folder

mkdir demoapp && cd demoapp && touch

In file, put the following code

from flask import Flask
app = Flask(__name__)

def home():
	return "Hello from flask file"

if __name__ == '__main__':

Make sure you are in the flask app root directory and run the following command from the terminal


flask run

Now, go ahead and open your preferred browser and navigate to

How to install Flask on Ubuntu 18.04 Video

Watch me install Flask on Ubuntu 18.04

By Tube Mint

I am a YouTuber and I also do niche marketing. In the process of create my niche blog using WordPress, Drupal, and GatsbyJS, I learned a few things like html, css, JS, CMS, MVC frameworks, C++, Python, Ruby, MySQL, Windows and Linux. After some time.. I realized that I can share my knowledge with people on YouTube and through my blog. So, here I am. You can ask me if you have any question about these technologies.