Learn Affiliate Marketing & Blogging

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 app.py

In app.py file, put the following code

from flask import Flask
app = Flask(__name__)

def home():
	return "Hello from flask app.py 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

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.