How to install Falsk on CentOS 8

How To Install Flask version 1.1.2 On CentOS 8

On this article we will show you how to install Flask version 1.1.2 on CentOS 8 operating system.

Introduction

Flask is an open source micro web framework for Python. It is called as a microframework because it does not require particular tools or libraries. Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools. Applications that use the Flask framework include Pinterest and LinkedIn. On this article we will discull how to install the lates version Flask on CentOS 8. Flask version 1.1.2 is the latest version which was releasod on 3 April 2020.

Flask Installation On CentOS 8

Prerequisites

Flask installation on CentOS 8 requires Python 3 installed first on the system. Fortunately on our system, there is Python version 3.63 installed. Python 3 installation on CentOS linux operating system can be found on How to Install and Configure Python 3.6.3 On Centos 7. We will verify Python installed on the system by querying its version, by submitting command line : python3 --version.

root@otodiginet ~]# python3 --version
 Python 3.6.8
Python version 3.6.8
Python version 3.6.8

Creating Virtual Environment

We will create a directory where Python 3 virtual environments is live. It can be home directory or any other directory, the most important thing is our user has read and write permissions on its directory. For this purpose we will create a new directory called as /projekgue. After that, we will create Python3 environment inside it. All steps are as shown below.

[root@otodiginet ~]# mkdir projekgue
[root@otodiginet ~]# cd projekgue/
[root@otodiginet projekgue]# python3 -m venv venv
[root@otodiginet projekgue]#  . venv/bin/activate

The last command line above is about to activate the environment.

Python Environment created
Python Environment created

After new environmet was created successfully, then next step it to do the Flask installation, by submitting command line : pip install Flask, as shown below :

(venv) [root@otodiginet projekgue]# pip install Flask
 Collecting Flask
   Downloading https://files.pythonhosted.org/packages/f2/28/2a03252dfb9ebf377f40fba6a7841b47083260bf8bd8e737b0c6952df83f/Flask-1.1.2-py2.py3-none-any.whl (94kB)
     100% |████████████████████████████████| 102kB 1.2MB/s 
 Collecting Jinja2>=2.10.1 (from Flask)
   Downloading https://files.pythonhosted.org/packages/7e/c2/1eece8c95ddbc9b1aeb64f5783a9e07a286de42191b7204d67b7496ddf35/Jinja2-2.11.3-py2.py3-none-any.whl (125kB)
     100% |████████████████████████████████| 133kB 1.4MB/s 
 Collecting Werkzeug>=0.15 (from Flask)
   Downloading https://files.pythonhosted.org/packages/cc/94/5f7079a0e00bd6863ef8f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl (298kB)
     100% |████████████████████████████████| 307kB 625kB/s 
 Collecting itsdangerous>=0.24 (from Flask)
   Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
 Collecting click>=5.1 (from Flask)
   Downloading https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82kB)
     100% |████████████████████████████████| 92kB 1.1MB/s 
 Collecting MarkupSafe>=0.23 (from Jinja2>=2.10.1->Flask)
   Downloading https://files.pythonhosted.org/packages/b2/5f/23e0023be6bb885d00ffbefad2942bc51a620328ee910f64abe5a8d18dd1/MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
 Installing collected packages: MarkupSafe, Jinja2, Werkzeug, itsdangerous, click, Flask
 Successfully installed Flask-1.1.2 Jinja2-2.11.3 MarkupSafe-1.1.1 Werkzeug-1.0.1 click-7.1.2 itsdangerous-1.1.0
 You are using pip version 9.0.3, however version 21.0.1 is available.
 You should consider upgrading via the 'pip install --upgrade pip' command.
Flask version 1.1.2
Flask version 1.1.2

The Flask 1.1.2 installation was completed done successfully. As recommendation above on Flask installation, we will upgrade the pip version to the last stable version by submitting command line : pip install --upgrade pip as shown below :

(venv) [root@otodiginet projekgue]# pip install --upgrade pip
 Collecting pip
   Downloading https://files.pythonhosted.org/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5MB)
     100% |████████████████████████████████| 1.5MB 320kB/s 
 Installing collected packages: pip
   Found existing installation: pip 9.0.3
     Uninstalling pip-9.0.3:
     Successfully uninstalled pip-9.0.3
 Successfully installed pip-21.0.1

Verify Flask Version

The last step is to verify the Flask installation on the system, by querying its version. This task can be done by submitting command line : python -m flask --version on the environment.

(venv) [root@otodiginet projekgue]# python -m flask --version
 Python 3.6.8
 Flask 1.1.2
 Werkzeug 1.0.1
Flask Version 1.1.2 installed on the system
Flask Version 1.1.2 installed on the system

Conclusion

The Flask version 1.1.2 installation on the CentOS 8 has been done successfully. For Python developer Flask is the best choice to enhance programming productivity. Have a nice day, stay at home an stay safe.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *