You seem to have a permission issue. From the log you pasted to pastebin:

error: could not create '/usr/local/lib/python3.4/dist-packages/flask': Permission denied

This is because pip will attempt to install the package globally unless you specify a certain installation location. If you want to install this globally you must use sudo or install as a user with privileges.

Try the following:

sudo pip3 install flask

Or specify to a certain dir:

pip install -t <path> flask

However, with the latter method you will have to always inject the path to sys.modules so I suggest you just use sudo if you can.

Or even more preferrably, use virtualenv. Virtualenv allows you to very easily package your application for production because you can install only the packages you need and you've thus got automatic package isolation. Generating a requirements.txt is then as simple as pip freeze > requirements.txt. Remeber that if you end using a virtualenv, you must not use sudo to install packages as they will then be installed outside the virtualenv.

Answer from msvalkon on Stack Overflow
🌐
Flask
flask.palletsprojects.com › en › stable › installation
Installation — Flask Documentation (3.1.x)
Virtual environments are independent groups of Python libraries, one for each project. Packages installed for one project will not affect other projects or the operating system’s packages. Python comes bundled with the venv module to create virtual environments. Create a project folder and a .venv folder within: ... Your shell prompt will change to show the name of the activated environment. Within the activated environment, use the following command to install Flask:
🌐
GeeksforGeeks
geeksforgeeks.org › installation guide › how-to-install-flask-on-linux
How to Install Flask on Linux? - GeeksforGeeks
July 23, 2025 - Wait for some time till the process is completed. It will take the help of Pip of Python to install Flask on the machine. ... Step 2: After successfully installing the Flask in the machine a special command should be run. This command is only executable by Linux operating system.
Discussions

python - How to install Flask on Python3 using pip? - Stack Overflow
I want to try using Flask with Python3. I've got Python 3.4 on Ubuntu 14.04, which supposedly ships with pip included. So I tried pip3 install flask this ends in: Cleaning up... Command /usr/bin/ More on stackoverflow.com
🌐 stackoverflow.com
Can't install Flask
Start a venv before you install any packages More on reddit.com
🌐 r/PythonLearning
2
4
February 5, 2025
Do I need to re-install Flask every time I boot my virtual environment up?
Are you confusing a virtual environment and a virtual machine? You used them together in the post and I wasn't sure which you meant. You only need to install flask a single time to a virtual environment. Create a virtual environment (lots of yt tutorials on this) Make sure the environment is activated. You should see the name of your environment in brackets above your active cursor in the command line. Pip install flask. Now everytime you want to work on your app you activate this same virtual environment. Flask and any other modules will already be installed in it. Virtual environments are like mini virtual machines but it's not a full os. It's just a small isolated environment which allows you to install your modules without conflicting with any other modules. A virtual machine is an entire operating system like Linux or windows. You are able to have as many virtual environments as you want, and it's good practice to keep it beside your code so you can always find it. You mentioned running in vscode, it's possible that when you're doing this, vscode is opening the file without using your virtual environment. Double check when you're running in vscode that your virtual environment is activate. If its not then you need to activate it first in the terminal in vscode and try again. If you have multiple terminals open these are all independant of each other so activating the virtual environment in one terminal, then trying to run the code from a different one won't work. Hope this helps, good luck! More on reddit.com
🌐 r/flask
3
0
September 30, 2023
How to deploy react + flask app
Congratulations on finish this! Now comes Dev ops. You'd need a few things to help with production. I'd recommend a Linux server coz of the selenium requirement. You should be serving with something like gunicorn. Add supervisord, a python package, to ensure workers are spinned up if they fail. You can further add nginx if you think you'll have some outsiders access this and need to start designing properly and scaling. As for selenium, I hope you are running it with the headless options enabled? Because Linux servers typically only have command line access and no x11 running. You can spoof one to run. Additionally, for example with Firefox, you'd need to download geckodriver and add it to your $PATH(create a link in /use/bin? If selenium needs to be called and run something and return values to frontend, you might want to look into installing Redis and python-rq to run those jobs. More on reddit.com
🌐 r/flask
25
17
August 7, 2020
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › how to install flask on linux, windows, and macos
How to Install Flask on Linux, Windows, and macOS
December 11, 2025 - We will install Flask in a virtual environment to avoid problems with conflicting libraries. Python 3 comes with a preinstalled virtual environment module called venv. If your system does not have venv or you previously removed it, the sections below show how to install the module on Linux, macOS, ...
🌐
RoseHosting
rosehosting.com › home › how to install flask on debian 12
How to Install Flask on Debian 12 | RoseHosting
November 27, 2023 - Once logged in, update the package ... can check this with the command: ... You can install Flask globally with the command pip3 install flask, but it’s recommended to create a virtual environment and install the Flask application ...
🌐
Red Hat
developers.redhat.com › blog › 2018 › 06 › 05 › install-python-flask-on-rhel
How to install Python Flask on Red Hat Enterprise Linux 7 | Red Hat Developer
March 24, 2023 - 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 ...
🌐
Virtono
virtono.com › community › tutorial-how-to › how-to-install-flask-on-ubuntu-and-centos
How To Install Flask On Ubuntu And CentOS - Virtono Community
September 20, 2023 - Let’s start with Ubuntu. Here’s a step-by-step guide to installing Flask on an Ubuntu system: You must update your system packages first. Then, enter the following command into the terminal: ... You are now prepared to install Flask.
🌐
TecAdmin
tecadmin.net › how-to-install-flask-on-debian
How to Create Flask Application on Debian – TecAdmin
April 26, 2025 - In this tutorial, we will show you how to install Flask on Debian Linux. Debian 11, also known as “Bullseye,” is the latest stable release of the Debian operating system.
Find elsewhere
🌐
Vultr
docs.vultr.com › how-to-install-flask-on-ubuntu-24-04
How to Install Flask on Ubuntu 24.04 Complete Guide | Vultr Docs
January 17, 2025 - This article explains how to install Flask on Ubuntu 24.04. You will install all required development packages, set up a virtual environment, and integrate Flask with Gunicorn to run web applications on the server.
🌐
Medium
medium.com › @mynameischandangupta1 › how-to-install-flask-on-ubuntu-84bce8419dc0
How to Install Flask on Ubuntu.. Prerequisites: | by Chandan Gupta (KeepMovingForward) | Medium
December 15, 2024 - How to Install Flask on Ubuntu. Prerequisites: Make sure you have the following prerequisites before we start the installation process: Basic knowledge of the Linux command line. Python 3 is …
🌐
Linuxize
linuxize.com › home › python › how to install flask on ubuntu 20.04
How to Install Flask on Ubuntu 20.04 | Linuxize
November 21, 2020 - Flask packages are included in the official Ubuntu repositories and can be installed using the apt package manager. This is the simplest way to install Flask on Ubuntu 20.04, but not as flexible as installing in a virtual environment.
🌐
KB Hosting
kb.hosting.com › docs › installing-and-configuring-flask-on-linux-shared-hosting
How to install and configure Flask on a Linux shared hosting account
Flask is a Python-based framework that enables you to quickly and easily create web applications. This article demonstrates how to install Flask and configure it on a Linux shared hosting account that uses cPanel.
🌐
Linux Hint
linuxhint.com › ultimate-guide-to-install-flask-on-ubuntu
Ultimate Guide to Install Flask on Ubuntu – Linux Hint
Follow the below-mentioned steps to install the Flask on Ubuntu 20.04 system: Ensure that Python is installed on your Ubuntu system. To check the installation, run the below-given command on the terminal: ... It is a recommended method to create a virtual environment in python using the venv module.
🌐
PyPI
pypi.org › project › Flask
Flask · PyPI
See our detailed contributing documentation for many ways to contribute, including reporting issues, requesting features, asking or answering questions, and making PRs. ... Download the file for your platform. If you're not sure which to choose, ...
      » pip install Flask
    
Published   Feb 19, 2026
Version   3.1.3
🌐
Python Geeks
pythongeeks.org › python geeks › learn flask › flask installation in easy steps
Flask Installation in Easy Steps - Python Geeks
May 5, 2023 - Run the following command to install Flask using pip, the Python package manager: ... Once Flask is installed, you can verify the installation by running the following command in your terminal: ... If you see the version number of Flask printed without any errors, it means that Flask is successfully installed in your virtual environment. Setting up Flask on a Linux machine is similar to setting it up on a Mac.
🌐
Twilio
twilio.com › docs › usage › tutorials › how-to-set-up-your-python-and-flask-development-environment
Set up your Python and Flask development environment | Twilio
In this guide, you'll set up your Python and Flask development environment to build Twilio applications. You'll install Python, create virtual environments, install Flask and the Twilio SDK, and set up ngrok for webhook testing.
🌐
Fedora Developer Portal
developer.fedoraproject.org › tech › languages › python › flask-installation.html
Flask — Fedora Developer Portal
To work in the virtual environment, you have to activate it. ... In an active the virtual environment (with the name (project_venv) included in your command line prompt), you can install Flask from PyPI.
🌐
Linuxize
linuxize.com › home › python › how to install flask on ubuntu 18.04
How to Install Flask on Ubuntu 18.04 | Linuxize
April 29, 2019 - Flask packages are also included in the official Ubuntu repositories and can be installed using the apt package manager. This is the easiest method to install Flask on Ubuntu 18.04, but not as flexible as installing in a virtual environment.
🌐
A2 Hosting
a2hosting.com › kb › developer-corner › python › installing-and-configuring-flask-on-linux-shared-hosting
How to install and configure Flask on a Linux shared hosting account
Learn how to install and configure a Flask application on a Linux shared hosting account. This Python-based framework enables you to quickly and easily create websites.
🌐
Readthedocs
flask-dev.readthedocs.io › en › latest › installation.html
Installation — Flask 0.11.dev documentation
To just get the development version without git, do this instead: $ mkdir flask $ cd flask $ virtualenv venv $ . venv/bin/activate New python executable in venv/bin/python Installing setuptools, pip............done. $ pip install Flask==dev ...