Ask which language is most often recommended to people starting out in programming and the answer is probably the same: Python. So what is Python, why is it so popular, and how do you install Python on a server to ship an app? In this post we first get to know Python and compare it with tables, then walk through installing it on a Linux server and deploying a simple app step by step.
What Is Python?
Python is an open-source, free programming language released by Guido van Rossum in 1991. Its biggest strength is readability: code reads almost like English, and blocks are defined by indentation instead of curly braces. Since it's an interpreted language, you can run code directly without compiling it.
A small example:
def greet(name):
return f"Hello, {name}!"
servers = ["web-1", "web-2", "db-1"]
for s in servers:
print(greet(s))
Even someone who has never programmed can roughly guess what this code does. That's the biggest reason people love Python.
Why Is Python So Popular?
- Easy to learn: The clean syntax lets beginners progress quickly.
- Huge library ecosystem: There's a ready-made package for almost everything; PyPI hosts hundreds of thousands of packages.
- Versatile: Web, data analysis, AI, automation... you can do very different things with the same language.
- Big community: The answer to almost any problem you run into is somewhere online.
Where Is Python Used?
| Area | Popular tools | Example |
|---|---|---|
| Web development | Django, Flask, FastAPI | Websites, REST APIs, admin panels |
| Data analysis | pandas, NumPy, Jupyter | Reporting, data cleaning, visualization |
| AI and machine learning | PyTorch, scikit-learn, Hugging Face | Model training, chatbots, forecasting models |
| Automation and scripting | Standard library, requests | File processing, sending reports, scheduled jobs |
| DevOps and system administration | Ansible, boto3, Fabric | Server configuration, cloud automation |
Python Compared to Other Languages
| Python | JavaScript (Node.js) | PHP | Go | |
|---|---|---|---|---|
| Ease of learning | Very easy | Easy | Easy | Medium |
| Runtime speed | Medium | Good | Good | Very good |
| Strongest at | Data, AI, automation, APIs | Web, real-time apps | Websites, CMS (WordPress) | High-performance services, infrastructure tools |
| Installing on a server | Easy (usually preinstalled on Linux) | Easy | Easy | Compiles to a single binary, very easy |
Python isn't the fastest language in raw speed, but since most heavy computation already happens in libraries written in C (like NumPy and PyTorch), it's rarely a problem in practice.
How to Install Python on a Server (Ubuntu 24.04)
Good news: Python 3 comes preinstalled on most Linux distributions; Ubuntu 24.04 ships with Python 3.12. What you need to add is the pip package manager and virtual environment support.
1. Check the current version and install what's missing
python3 --version
sudo apt update
sudo apt install -y python3-pip python3-venv
2. Work with a virtual environment (venv)
On recent Ubuntu versions, if you try to pip install straight into the system Python you'll get an externally-managed-environment error. It's not a bug but a deliberate safeguard, so you don't break packages that system tools rely on. The right way is to use a seperate virtual environment for each project:
mkdir -p ~/myapp && cd ~/myapp
python3 -m venv .venv
source .venv/bin/activate # activates the virtual environment
pip install --upgrade pip
pip install fastapi uvicorn
deactivate # to leave when you're done
Packages you install inside the virtual environment belong only to that project; different projects can use different versions without breaking each other.
3. If you need a different Python version
If your project needs a different Python version than the system one, the most practical way to install it without touching the system Python is uv. It's both a very fast package manager and downloads and manages Python versions itself:
curl -LsSf https://astral.sh/uv/install.sh | sh
source ~/.bashrc # so the uv command is on your PATH
uv python install 3.13 # downloads the version you want
uv venv --python 3.13
source .venv/bin/activate
uv pip install fastapi uvicorn
Python Installation Methods Compared
| Method | When? | Note |
|---|---|---|
| apt (system package) | When the system version is good enough | Easiest; install packages inside a venv |
| venv | For every project | Ships with Python, nothing extra to install |
| uv | When you need another version or want fast installs | Versions + virtual envs + packages in one tool |
| pyenv | When you juggle many versions on the same server | Builds versions from source, takes a bit longer |
| Docker | When you want the environment identical everywhere | The most consistent option with the official python images |
Deploying a Python App on a Server
Installation's done, now let's ship a simple web API. If you're wondering what an API is, see our What is an API post.
1. Write the app
Create a file called main.py in the project folder:
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def home():
return {"message": "Hello from VECDC!"}
2. Run and test it
source .venv/bin/activate
uvicorn main:app --host 0.0.0.0 --port 8000
# open http://SERVER_IP:8000 in your browser
If you see a JSON response, the app works. But it stops the moment you close the terminal; let's make it permanent.
3. Make it a permanent service with systemd
Create /etc/systemd/system/myapp.service (adjust the user name and paths to your setup):
[Unit]
Description=My Python app
After=network.target
[Service]
User=deploy
WorkingDirectory=/home/deploy/myapp
ExecStart=/home/deploy/myapp/.venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000 --workers 2
Restart=always
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now myapp
sudo systemctl status myapp
Now the app starts on its own even after a reboot and restarts automatically if it crashes.
4. Expose it with Nginx
Rather than exposing the app directly to the internet, it's best to put Nginx in front of it; Nginx handles SSL, compression and static files. A simple configuration:
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
After this step, don't forget to add a free SSL certificate (Let's Encrypt) for your domain.
Common Problems
| Error / symptom | Cause | Fix |
|---|---|---|
error: externally-managed-environment | Trying to install packages into the system Python | Use a virtual environment (venv) |
python: command not found | On Ubuntu the command is python3 | Type python3 or run sudo apt install python-is-python3 |
ModuleNotFoundError | The virtual environment isn't active or the package isn't installed | source .venv/bin/activate, then install the package |
Address already in use | The port is used by another app | Pick a different port or stop the other process |
| Service won't start | Wrong path or user | Check the logs with journalctl -u myapp |
Which Server for Python Apps?
For a small or mid-size Python web app, API or automation script you don't need a big server. VECDC virtual servers start at $6/month with NVMe storage and dedicated CPU, and are ready in about 5 minutes with automated setup. If you'll work with Docker, Developer VDS, delivered with Docker installed, makes things even easier. If you're thinking about running AI models with Python, our how AI runs on a virtual server post may help too.
Frequently Asked Questions
Is Python free?
Yes. Python is open source and completely free; you can use it in commercial projects without paying any license fee. Most packages are free and open source as well.
Should I learn Python 2 or Python 3?
Definitely Python 3. Python 2 reached end of life in January 2020 and no longer gets security updates. All new projects should be written in Python 3.
What is pip?
pip is Python's package manager. It lets you download and install libraries from PyPI with the pip install command. On servers, it's recommended to install packages inside a virtual environment (venv).
Is Python a good choice for building websites?
Yes. With frameworks like Django, Flask and FastAPI you can build websites, admin panels and APIs. Python powers the backend of many large platforms.
In Short
Python is an easy-to-learn yet powerful language used in a huge range of areas, from the web to AI. It usually comes preinstalled on Linux servers; set it up properly with a virtual environment and you can ship your app in a few steps with systemd and Nginx. If you get stuck during the setup, drop us a message, were happy to help.