Urgent.News

What's breaking now, across thousands of outlets.

Tech

Architectural Breakdown: Installing Flask on Ubuntu 24.04

# Flask on Ubuntu 24.04: Why Your Simple Install Broke at 2 AM It was 2:47 AM when the alert hit. Our uWSGI workers on the new Ubuntu 24.04 staging box had started swapping. Not throttling, not complaining, full memory-pressure swap thrashing that turned a simple health check into a 12-second GET request. Load average read 8.4 on a 2-core instance with 8GB RAM, and half of that was occupied by a…

At 2:47 AM, an alert signaled trouble with the staging box running Ubuntu 24.04. The issue was uWSGI workers swapping due to excessive memory pressure, causing a 12-second GET request instead of a simple health check. The load average reached 8.4 on a 2-core instance with 8GB RAM, primarily due to an unnecessary dependency graph.

Inspecting the installed packages with `pip freeze` revealed 47 packages, despite the application's codebase being limited to three files. The culprit was Werkzeug 2.3.x, incompatible with Flask 3.0.3, which was pulled in from an outdated middleware package. Werkzeug's 2.x version is incompatible with Flask's 3.x API layer, leading to an import chain resolving to the wrong package. This mistake was only discovered after the OOM killer started writing to syslog.

Ubuntu 24.04 ships Python 3.12, but Flask 3.x requires Werkzeug 3.0, Jinja2, click, itsdangerous, blinker, and importlib-metadata. The official installation method, `apt install python3-flask`, installs a distro-pinned Werkzeug 2.x, causing routing issues under production load. The correct installation path involves explicitly setting Python 3.12, upgrading the resolver, creating a virtual environment, and installing Flask with specific version constraints.

This ensures the virtual environment remains isolated from system packages, preventing conflicts and ensuring proper functionality.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

All that glitters is not gold...

Mantendo a coerência temporal de meus textos, escrevo esse texto 1 ano e 17 dias após a minha promoção para líder técnico do meu time e após 17 dias do meu pedido de demissão, sim eu pedi demissão.

  • Technical leader resigns after witnessing corporate humiliation of colleagues
  • April 8 marked the day of discovery of toxic work environment
  • Identified numerous problems, blamed organizational culture for failures

10 Terminal Productivity Tips That Actually Save Time

Introduction We all spend a chunk of our day in the terminal. Whether you're a seasoned developer or just starting, small tweaks can compound into major time savings.

  • Master tab completion to complete commands, options, and Git branches
  • Use Ctrl+R for reverse search to quickly find previously executed commands
  • Create aliases for frequently used commands to reduce typing

My Research Journal: I Thought Web Scraping Was the Hard Part

The modern web is honestly astonishing. There are layers upon layers of security mechanisms working behind the scenes, and some of these systems are so sophisticated that even web developers might…

  • Web scraping is complex due to layers of security mechanisms.
  • Headless browsers frequently get blocked by sophisticated detection systems.

Stop Stressing! Build a Real-Time HRV Anomaly Detector with Python and Scikit-Learn

Ever had your smartwatch buzz at you during a meeting, telling you to "take a breath," only to realize your heart is racing because of a 10 AM deadline? That’s Heart Rate Variability (HRV) in action.

  • Real-time HRV anomaly detector built using Python and Scikit-learn
  • Isolation Forest algorithm identifies stress anomalies without labeled data
  • Front-end visualizes data with D3.js, highlights anomalies in red

More from Thursday 10 September →