DEV Community

Cover image for Python Setup for Real Projects: VS Code, venv, pip and requirements.txt
Zestminds Academy
Zestminds Academy

Posted on • Originally published at zestmindsacademy.com

Python Setup for Real Projects: VS Code, venv, pip and requirements.txt

Many Python beginners can write basic programs but get stuck when they try to run a real project on their own laptop.

The issue is not always coding.

Sometimes the real problem is setup.

You may know loops, functions, and lists, but still face problems like:

ModuleNotFoundError
Python is not recognized
Package installed but not working in VS Code
Wrong interpreter selected
Enter fullscreen mode Exit fullscreen mode

These are common beginner setup issues.


Why online compilers are not enough

Online compilers are good for quick practice.

But real Python projects need:

  • project folders
  • multiple files
  • external packages
  • virtual environments
  • dependency files
  • terminal commands
  • debugging tools
  • Git basics

So, when the goal is to build real projects, it is better to move to a local Python setup early.


Basic Python project setup flow

A simple Python project setup flow looks like this:

Install Python
Install VS Code
Create project folder
Create virtual environment
Activate virtual environment
Install packages
Save requirements.txt
Enter fullscreen mode Exit fullscreen mode

This setup may look basic, but it prevents many beginner-level errors later.


Example folder structure

A beginner-friendly Python project folder can look like this:

python-project/
│
├── main.py
├── requirements.txt
├── README.md
└── venv/
Enter fullscreen mode Exit fullscreen mode

Here is what each file or folder means:

  • main.py is the main Python file.
  • requirements.txt stores project dependencies.
  • README.md explains the project.
  • venv/ contains the virtual environment.

Create a virtual environment

Create a virtual environment using:

python -m venv venv
Enter fullscreen mode Exit fullscreen mode

Activate it on Windows:

venv\Scripts\activate
Enter fullscreen mode Exit fullscreen mode

Activate it on Mac/Linux:

source venv/bin/activate
Enter fullscreen mode Exit fullscreen mode

A virtual environment keeps each project’s packages separate. This helps avoid package conflicts when working on multiple Python projects.


Install a package

After activating the virtual environment, install packages using pip.

Example:

pip install requests
Enter fullscreen mode Exit fullscreen mode

Now create a Python file:

import requests

response = requests.get("https://api.github.com")
print(response.status_code)
Enter fullscreen mode Exit fullscreen mode

If everything is set correctly, this should print a response status code like:

200
Enter fullscreen mode Exit fullscreen mode

Save dependencies

After installing packages, save them in requirements.txt:

pip freeze > requirements.txt
Enter fullscreen mode Exit fullscreen mode

Later, the same dependencies can be installed using:

pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

This is useful when sharing projects with teammates, trainers, or during internships.


Beginner mistakes to avoid

Avoid these common setup mistakes:

  • Installing packages globally for every project
  • Not activating venv before installing packages
  • Selecting the wrong interpreter in VS Code
  • Running commands from the wrong folder
  • Naming files like requests.py, pandas.py, or flask.py
  • Uploading the venv folder to GitHub

These mistakes are very common. They do not mean someone is weak in Python. They usually mean the project setup is not clear yet.


VS Code or Jupyter?

Use VS Code when building structured projects with folders, multiple files, APIs, scripts, and reusable code.

Use Jupyter Notebook when doing data analysis, experiments, visual outputs, or step-by-step testing.

Both are useful.

But for real project structure, VS Code is a good starting point.


Final note

A proper setup will not make you an expert overnight, but it will reduce confusion and help you work more like a real developer.

Before building bigger Python projects, beginners should understand:

  • project folders
  • virtual environments
  • package installation
  • dependency files
  • interpreter selection
  • basic Git awareness

I wrote a deeper beginner-friendly version here:
Python Development Environment Setup for Real Projects

Top comments (0)