Over a million developers have joined DZone.

How to Install Python Flask on Red Hat Enterprise Linux 7

DZone's Guide to

How to Install Python Flask on Red Hat Enterprise Linux 7

Is it ever as easy as it seems? Check out some of the challenges this developer faced when installing Python Flask so you can avoid them.

· Open Source Zone ·
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

I recently got my zero-dollar developer copy of Red Hat Enterprise Linux (RHEL, version 7.5) and built a virtual machine (VM) to run it. There it was, on my PC, running in VirtualBox...a gleaming, shiny, brand-spanking-new VM running RHEL. Whatever shall I do with it?

Then I got the idea: I'll install the Red Hat Container Development Kit (CDK) and build some Python-based containers. I'll use Flask, a terrific microframework that makes building RESTful services easy.

"But I Don't Have RHEL 7.5..."

If you aren't using RHEL 7.5, not to worry. Because Python 3 is part of the Red Hat Software Collections (RHSCL), this works with all minor versions of RHEL 7.

I Mean...Obviously...

Obviously, installing Flask would be easy. With the confidence that often accompanies ignorance, I went to the command line and typed the simple command pip install flask and waited for the good news.


RHEL is Yummy

Well, hang on a minute; I'm on RHEL, so yum is the package manager (that is, installation utility). Obviously, the correct command is sudo yum install pip.

yum search to the Rescue

Frustrated, but not to be defeated, I figured pipa Python utility — must be part of the Python package for RHEL. I used the command yum search python36 to see if any Python 3.6 packages were available, and voila!

Aha! A package specifically built by Red Hat. Finally, the install command I was looking for:sudo yum install rh-python36-python-pip.noarch

I'm An Enabler

Now, all I needed to do was enable it in a bash shell session and I'd be ready to start writing Python code using Flask:

sudo scl enable rh-python36 bash

I then immediately ran pip install --upgrade pip and my pip installation was updated to version pip-10.0.1.

Ready for Flask

Now, finally, I could install Flask by running pip install flask.


Finally — for real this time — I tested it by creating and running the hello.py app that's featured on the Flask project home page. It worked.


I now have Python 3.6 and Flask installed on my RHEL VM. All I need to do now is to install the CDK and I can start building Python microservices.

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

open source ,installation ,barriers ,python ,python flask

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}