Set Up a Virtualenv and Install Flask
Create an isolated environment and pip install Flask.
Set Up a Virtualenv and Install Flask is a free Flask Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Flask Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Isolate Projects
Each project wants its own package versions. A virtual environment keeps Flask and friends separate from your system Python.
Meet venv
Python ships venv, a built-in tool that creates a private folder holding a fresh, isolated copy of pip and packages.
Create the Environment
Run the venv module and pick a folder name like .venv. This builds your isolated environment in seconds. ✨
python -m venv .venvActivate on macOS and Linux
Activating points your shell at the env. On macOS or Linux you source the activate script inside the env folder.
source .venv/bin/activateActivate on Windows
On Windows the activation script lives under Scripts. Run it and your prompt shows the env name, confirming it is on.
.venv\Scripts\activateConfirm It Worked
When active, your prompt is prefixed with the env name. Now pip installs land only inside this project, not globally.
Install Flask
With the env active, install Flask using pip. It pulls Flask plus its dependencies like Werkzeug and Jinja2.
pip install FlaskVerify the Version
Check that Flask is installed and see its version. A clean version number means you are ready to write code.
python -m flask --versionFreeze Your Dependencies
pip freeze lists exact versions. Saving them lets teammates rebuild the same environment later with one command.
pip freeze > requirements.txtReinstall from the File
Anyone can recreate your setup from requirements.txt, so your project runs the same on every machine.
pip install -r requirements.txtDeactivate When Done
Type deactivate to leave the environment and return to your normal shell. Reactivate any time you work on the project.
deactivateQuick Check
Quick check on isolating your project.
Recap
You created a venv, activated it, installed Flask with pip, and froze your deps. Your isolated workspace is ready to build. 🎉
Frequently asked questions
Is the “Set Up a Virtualenv and Install Flask” lesson free?
Yes — the full text of “Set Up a Virtualenv and Install Flask” is free to read here on the web, and the Flask Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Flask Academy course, upgrade to CoddyKit PRO.
What will I learn in “Set Up a Virtualenv and Install Flask”?
Create an isolated environment and pip install Flask. You practise Flask Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Flask Academy?
No prior experience is required. Flask Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Set Up a Virtualenv and Install Flask” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Flask Academy lesson?
Yes. Every Flask Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What Flask Is and Why It Exists
- Set Up a Virtualenv and Install Flask
- Hello World: Your First Flask App
- Run the Dev Server with Debug Mode