Install Flask 2.0.2

ActiveState has made it easy to install the latest version of Flask. Copy and paste the snippet below into your terminal to install a verified, built-from-source version of Flask from ActiveState's free repository. We've taken care of all the dependencies so you don't have to.

Flask Logo

Run the following command in your terminal

pip3 install --index-url https://har.activestate.com/activestate/trusted-artifacts/latest flask==2.0.2

The --index-url parameter tells pip to install the package from ActiveState's repository.

Built for

  • OSX
  • Linux
  • Windows

Compatible with

Compatible with 3.7, 3.8 & 3.9

Why install Python packages from ActiveState?

ActiveStatePyPIAnaconda
/ conda

Built from source code

We build all packages from known and vetted source code. The source code is stored indefinitely on our secure supply chain. This reduces the likelihood of specific types of exploits while eliminating typosquatting.

VariesVaries

Support for OS-level dependencies

Artifact dependencies extend to the operating-system level. For example, when building XML libraries for Python, we also build Expat from its C source files.

Vetted new source releases

Source is updated as new versions are released, but after a manual and automatic review process and at 24-48 hour delay compared to the main public repository.

Varies

Artifacts built for Linux, MacOS, Windows

Isolated and ephemeral build environments

Build stages are conducted in single-use build environments that are discarded after the build is complete. Builds are run automatically based on known and version-controlled configurations.

Varies

Revision-controlled build history

The ActiveState Platform maintains a catalog of all source code used to build artifacts, along with all available metadata. This information is revision-controlled and immutable (except when a change is essential for security or privacy reasons).

Varies

Machine-readable SBOM

We store all provenance metadata available for all artifacts, exposing it as machine-readable SBOM files.

Supply chain levels for Software Artifacts (SLSA) Level 4

SLSA is led by an initial cross-organization, vendor-neutral steering group committed to improving the security ecosystem for everyone. SLSA Level 4 requires two-person review of all changes and a hermetic, reproducible build process.

Get these features and more with the ActiveState Platform.

Our enterprise-grade platform can help streamline your Python, Perl & Tcl workflows.

Create a free account

97% of the Fortune 1000 companies use ActiveState

For more than 20 years, ActiveState has been making open source easier, more secure, and less risky.

Cisco Logo
Tesco Logo
NASA Logo
Verizon Logo
Texas Instruments Logo
Toyota Logo
Capital One Logo
Siemens Logo

Frequently Asked Questions

What is Flask?

Flask is a web framework written in Python that lets you easily develop web applications. The two most popular frameworks for Python, Django and Flask, take incredibly different approaches to web development. Django, the older of the two frameworks, is often called a “batteries included” framework, meaning that it contains just about everything you need to launch a full featured application in no time flat. Flask, on the other hand, is a highly extensible “microframework” that launches with a bare minimum set of features, but has a thriving plugin ecosystem which allows developers to only include the functionality that they need to succeed.

Flask is based on the Werkzeug WSGI toolkit and the Jinja2 template engine and is considered very Pythonic, meaning it follows the conventions of the Python community and uses the language as intended. It’s explicit and readable.

Which Python versions are compatible with Flask?

Flask is compatible with Python 3.7 and up. Flask is not compatible with Python 2.

What dependencies does Flask have?

Flask has the following dependencies, which will be installed automatically when installing Flask.

  • Werkzeug, a utility library for WSGI. The WSBI protocol lets your web applications talk to the webserver and makes sure they work well together.
  • Jinja2, a Python template engine used to create HTML, XML or other markup formats that are returned to the user via an HTTP response.
  • MarkupSafe, which comes with Jinja2, escapes characters so text is safe to use in HTML and XML.
  • ItsDangerous, which helps pass data to untrusted environments and to get it back safe and sound, in this case protecting Flask’s session cookie.
  • Click, which is a tool for creating command line interfaces, and provides the flask command.
How do you install Flask globally and in a virtual environment?
Installing Flask Globally

Copy (either ctrl+c or just click the “copy” button) and paste the snippet at the top of this page into your command line. As with all Python packages installed with Python’s default package manager, pip, Flask will be installed to %PYTHONHOME%/site-packages.

Installing Flask in a Virtual Environment

You can also work in a virtual environment to prevent conflicts. You can use pip to install a specific version of the Flask package into a virtual environment  for Python 3 projects with the following command:

python
python3 -m venv <path_to_env>

venv will create a virtual Python installation in the <env_name> folder.

Activate <env_name> with the following command:

On Linux

python
source <env_name>/bin/activate

On Windows

You can pip install Flask into your virtual environment with the following command:

python
python -m pip install flask

If you want to create a development server on your local computer, you can do so easily. Save your program as server.py and run it with python server.py.

For example:

python
$ python server.py
* Serving Flask app "hello"
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Where does Flask install to?

As with all Python packages installed with pip, Flask will be installed to %PYTHONHOME%/site-packages. This will install Flask globally. However, we always recommend installing into a virtual environment (like virtualenv).

Does Flask work on Windows, Linux and Mac?

While Flask will work on Windows, Mac & Linux (Ubuntu, CentOS, RHEL, etc.), our implementation currently does not support Mac deployments.

How is Flask commonly used?

Flask makes it easy to build web applications since you can build a Flask application quickly using only a single Python file. It’s great for both beginner and complex use cases.

For example, you can create the “Hello World” application in your development environment as a simple Flask application with the following code:

python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()