Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

How to install Python Flask on Red Hat Enterprise Linux 7

June 5, 2018
Don Schenck
Related topics:
LinuxMicroservicesPython
Related products:
Red Hat Enterprise Linux

    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.

    Oops.

    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.   Note: if sudo doesn't work for you see How to enable sudo on Red Hat Enterprise Linux.

    yum search to the Rescue

    Frustrated, but not to be defeated, I figured pip—a 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.

    (Editor's Note: To install Python 3.6 you need to enable  the RHSCL and Optional software repos for yum.  See How to install Python 3, pip, venv, virtualenv, and pipenv for more information.)

     

    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 microframework

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

    Editor's Note: Using Python virtual environments and avoiding pip install as root are best practices. See How to install Python 3, pip, venv, virtualenv, and pipenv for more information.

    Success!

    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.

    Python Microservices

    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.

     

    Last updated: March 24, 2023

    Recent Posts

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    • Configure a split disk on OpenShift Container Platform

    • Red Hat Enterprise Linux 10.2 and 9.8: Top features for developers

    • What GPU kernels mean for your distributed inference

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.