Frequently Asked Questions

Q

My app crashes with "ModuleNotFoundError: No module named 'cgi'"

A

ModuleNotFoundError Example

Traceback (most recent call last):
  File "/app/server.py", line 3, in <module>
    import cgi
ModuleNotFoundError: No module named 'cgi'

Yeah, they deleted it. Along with 18 other modules. Because fuck backwards compatibility, right? PEP 594 nuked: aifc, audioop, cgi, cgitb, chunk, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, and xdrlib.

Copy these, they work:

  • cgi.parse_qs()urllib.parse.parse_qs()
  • imghdr.what()pip install pillow then PIL.Image.open()
  • mailcap.findmatch()mimetypes.guess_type()
Q

"ERROR: No matching distribution found for package X"

A

Pip Install Error

ERROR: Could not find a version that satisfies the requirement some-package==1.2.3
ERROR: No matching distribution found for some-package==1.2.3

The maintainer hasn't built wheels for Python 3.13 yet. Or they just don't give a shit about supporting the latest Python version. Here's what actually works when you're stuck:

  • Check the conda-forge migration tracker - they usually get wheels before PyPI
  • Stick with Python 3.11 or 3.12 until this resolves (6-12 months is normal)
  • Try pip install --pre some-package for release candidates
  • If you're feeling masochistic, compile from source with pip install --no-binary :all:
Q

"Microsoft Visual C++ 14.0 is required" or compilation garbage

A
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio"
building 'some_extension' extension
gcc: error: Python.h: No such file or directory

Feels like 2010 all over again - you're compiling C extensions because nobody bothered making wheels for Python 3.13 yet.

What actually works:

  • Windows: Install "Microsoft C++ Build Tools" (not the full Visual Studio)
  • Ubuntu: sudo apt install build-essential python3-dev
  • macOS: xcode-select --install
  • Better option: Use conda/mamba instead - they have binaries when PyPI doesn't
  • Nuclear option: Downgrade to Python 3.12 where everything has wheels
Q

Should I upgrade to production right now?

A

Fuck no. Not unless you enjoy 3am debugging sessions.

It's been almost a year since release and Python 3.13.7 finally works, but your dependencies might still be fucked. I learned this the hard way when our Django app died because we used cgi.parse_qs in some forgotten legacy module.

Reality check timeline:

  • Wait 6+ months minimum for ecosystem stability
  • Check every single package in requirements.txt has 3.13 wheels
  • Test thoroughly in staging - compatibility hell is real
  • Python 3.12 gets security updates until 2028, so there's no rush

I made this mistake in June 2024 trying to be an early adopter. Spent a weekend migrating our API, only to find that psycopg2 wheels didn't exist yet and compilation kept shitting the bed with cryptic GCC errors. Rolled back and waited until December. Learned the hard way that being first to upgrade just means first to break.

Q

The REPL looks weird with colors and shit

A
>>> print("hello")  # This line is now syntax highlighted
hello
>>> # Multi-line editing works but feels wrong

Python 3.13's new REPL has colors and multi-line editing. If you hate it:

  • export PYTHON_BASIC_REPL=1 - back to the old boring REPL
  • export NO_COLOR=1 - disable colors only
  • Add these to your .bashrc or .zshrc to make it permanent

How to Upgrade Without Losing Your Mind

Python 3.13 Release

Python 3.13 dropped on October 7, 2024, and broke everything. A year later, most packages work, but you'll still hit weird edge cases. Here's what I wish someone had told me before I spent 6 hours debugging why our Flask app wouldn't start.

What Actually Broke (The Real List)

PEP 594 nuked 19 modules that your legacy code probably uses:

import cgi          # Dead - use urllib.parse instead
import imghdr       # Dead - use Pillow
import mailcap      # Dead - use mimetypes  
import audioop      # Dead - use pydub or numpy
import telnetlib    # Dead - use paramiko
## Plus 14 others nobody remembers using

They also killed the 2to3 tool (who cares) and tkinter.tix (affecting maybe 3 people worldwide). But the module removals will fuck you over.

Real impact: I found cgi.parse_qs() buried in a utility function we'd forgotten about from 2019. Took 2 hours to track down why our form parsing broke - users were getting blank form submissions and we had no clue why. The error message was useless: "ModuleNotFoundError: No module named 'cgi'". Zero indication where the import was happening. Thanks Python.

Test This Shit Before You Break Production

Python Version Testing

Check what's gonna break before it breaks. Don't be that person who YOLOs an upgrade into prod.

## Find what's broken before 3.13 breaks it
pip check                    # Shows dependency conflicts
pipdeptree                   # Visual dependency graph
pip list --outdated          # What needs updating

## Test 3.13 compatibility
python3.13 -m venv test_env
source test_env/bin/activate
pip install -r requirements.txt  # See what explodes

Package status reality check (as of late 2024):

Spent last month helping a client migrate their data pipeline. All the major packages worked fine, but they had three internal utilities that used imghdr and audioop that took a day to fix. Always the old code that gets you.

The conda-forge migration tracker shows what actually works, unlike PyPI's bullshit green checkmarks.

The Waiting Game (Don't Rush This Shit)

Python Speed's upgrade analysis nailed the timeline: Python 3.13.1 (December 2024) was when things actually stabilized. The .0 release was a buggy mess like always.

Timeline reality check:

  • October 2024: Python 3.13.0 released - don't touch it
  • December 2024: Python 3.13.1 - major packages start working
  • March 2025: Most scientific packages have wheels
  • June 2025: Safe for new projects
  • Late 2025: Finally safe for production migrations

Unlike the Python 3.11 clusterfuck where packages took 6+ months, the 3.13 ecosystem was mostly ready within 2-3 months. Still, wait for 3.13.1+ minimum.

Alright, enough bitching. Here's how to actually do this without losing your mind:

  1. Test in development first (obviously)
  2. Staging environment with real data
  3. Production only after 6+ months of testing
  4. Python 3.13 gets support until October 2029, so there's no rush

Fixing the Broken Modules (Copy-Paste Replacements)

The official replacement guide is comprehensive but academic. Here's what actually works:

Common replacements I've tested:

## OLD (broken in 3.13)
import cgi
parsed = cgi.parse_qs(query_string)

## NEW (works)
import urllib.parse
parsed = urllib.parse.parse_qs(query_string)

## OLD (broken)
import imghdr
format = imghdr.what(file_path)  

## NEW (install pillow first: pip install pillow)
from PIL import Image
img = Image.open(file_path)
format = img.format.lower()

## OLD (broken)
import mailcap
type, encoding = mailcap.findmatch(caps, 'text/html')

## NEW (built-in)
import mimetypes
type, encoding = mimetypes.guess_type(filename)

For legacy codebases: Some rando packages on PyPI claim to provide compatibility shims, but I wouldn't trust them in production. Just fix your code properly.

War story: I spent 3 hours debugging a file upload feature that used cgi.FieldStorage. Turned out it was a 20-minute fix once I found the right Stack Overflow answer, but our error logs just showed "500 Internal Server Error" with no useful details. Classic Python - the docs are three years out of date and Stack Overflow has 47 different solutions that don't work.

Pro tip: Use python -Wd to catch deprecated module usage before you upgrade. Would've saved me those 3 hours if I'd run this in 2024 when Python 3.12 was warning about the cgi module removal. Check the migration guides on GitHub for more real-world examples.

Python Package Dependencies

Other shit that might help:

The Bottom Line

Python 3.13 migration isn't as bad as the 2-to-3 disaster, but it's not trivial either. The module removals will catch you off guard, C extension compilation will frustrate you, and package compatibility will make you question your life choices.

My recommendation? Wait until 3.13.3+ (probably early 2026), test everything twice in staging, and keep Python 3.12 around as a backup. The new features aren't worth the debugging headaches unless you need free-threading for something specific.

When shit inevitably breaks, at least now you've got working fixes instead of digging through docs written by people who've never touched a production server.

Should You Upgrade? Honest Answer

Python Version

Security Support

Package Support

Should You Use It?

3.8

Dead (Oct 2024)

Legacy only

No

  • upgrade immediately

3.9

Dying (Oct 2025)

Decreasing

Upgrade by end of 2025

3.10

Until Oct 2026

Full support

Solid choice, no rush to upgrade

3.11

Until Oct 2027

Full support

Sweet spot

  • stable with good performance

3.12

Until Oct 2028

Full support

Current production standard

3.13

Until Oct 2029

Most packages work

Good for new projects, test extensively for existing

When Everything Goes to Shit - Advanced Debugging

Q

"AttributeError: module 'os' has no attribute 'tempnam'"

A

AttributeError: module 'os' has no attribute 'tempnam'AttributeError: module 'audioop' has no attribute 'ratecv'Congrats, you found code that relied on deprecated shit nobody should use anymore.

The error message tells you absolutely nothing useful as usual.Debug this garbage:

  • Run with python -Wd to see warnings you've been ignoring for years
  • Search the Python 3.13 changelog for the missing attribute
  • Check if it moved to another module (it probably did)
  • For os.tempnam() specifically: use tempfile.mktemp() instead
Q

Docker builds are fucked - "No module named X" everywhere

A

Docker Build Failed```Step 4/8 :

RUN pip install -r requirements.txt ---> Running in 9c8f5b4d2e3aERROR: Could not find a version that satisfies the requirement some-package```Alpine Linux strikes again.

Or you're trying to compile C extensions in a minimal container without build tools.Copy-paste fixes:```dockerfile# For slim images that actually work:

FROM python:
3.13-slimRUN apt-get update && apt-get install -y build-essential python3-dev```

  • Skip Alpine unless you hate yourself
  • it breaks everything due to musl vs glibc bullshit
  • Use python: 3.13-bullseye for maximum compatibility with C extensions
  • Try python: 3.13-slim-bullseye as a middle ground
  • smaller but still works
  • Multi-stage builds if you must minimize image size
  • compile in fat image, copy to slim image
Q

C extensions won't compile - "error C2039: unknown type name"

A

 Python.h: No such file or directoryfatal error C1083:

 Cannot open include file: 'Python.h'src/extension.c(23): error C2039: 'PyObject': unknown type name```Python 3.13 changed some C API shit and your extension is from 2019.

 Time to update or abandon ship.**Try this shit:**
- Update Cython to 3.0.5+ 
- they fixed the 3.13 compatibility 
- Check if the package has a newer release (probably not)
- Use the [stable ABI](https://docs.python.org/3/c-api/stable.html) if you're maintaining this yourself
- Consider [scikit-build-core](https://scikit-build-core.readthedocs.io/) for less painful C++ builds
Q

My code runs slower on 3.13 - what the hell?

A

The JIT is disabled by default and free-threading adds overhead even when you don't use it.

Plus they changed some internal optimizations.Debug your performance regression:

  • Try python -X jit
  • the JIT might help CPU-heavy code (but adds startup overhead)
  • Profile with cProfile to find actual bottlenecks: python -m cProfile -s cumtime your_script.py
  • Compare identical workloads: time python3.12 script.py vs time python3.13 script.py
  • Could be your packages
  • some had to rewrite optimizations for 3.13 compatibility
  • Use py-spy for live profiling if the regression happens in production
  • Performance varies a lot between workloads
  • I/O bound code sees no difference
Q

pip can't resolve dependencies - "ResolutionImpossible"

A

ResolutionImpossible: Could not find a version that satisfies the requirement package-a>=2.0; package-b<3.0 requires package-a<2.0```Welcome to dependency hell.

 Some packages support 3.13, their dependencies don't, and pip gives up.**Fixes that actually work:**
- `pip-tools` 
- generates locked requirements that actually resolve
- Switch to Poetry or PDM 
- better dependency resolution than pip
- Use separate virtual environments for testing before migration
- Consider conda/mamba 
- they solve this better than pipThis shit happened to me with a Flask project where `requests-oauthlib` needed an older version of `requests` that conflicted with everything else. Took an hour with Poetry to sort out what pip couldn't figure out in 3 attempts. The dependency resolver in pip is garbage.

Related Tools & Recommendations

tool
Similar content

Python 3.13 Production Deployment: What Breaks & How to Fix It

Python 3.13 will probably break something in your production environment. Here's how to minimize the damage.

Python 3.13
/tool/python-3.13/production-deployment
100%
tool
Similar content

Python 3.13: Enhanced REPL, Better Errors & Typing for Devs

The interactive shell stopped being a fucking joke, error messages don't gaslight you anymore, and typing that works in the real world

Python 3.13
/tool/python-3.13/developer-experience-improvements
100%
tool
Similar content

Python 3.13 Migration Guide: Upgrade & Fix Threading Issues

Should You Upgrade or Wait for Everyone Else to Find the Bugs?

Python 3.13
/tool/python-3.13/migration-upgrade-guide
91%
tool
Similar content

Python 3.13 REPL & Debugging: Revolutionizing Developer Workflow

Took them 15 fucking years, but they finally fixed this

Python 3.13
/tool/python-3.13/developer-workflow-improvements
89%
tool
Similar content

Python 3.13 Team Migration Guide: Avoid SSL Hell & CI/CD Breaks

For teams who don't want to debug SSL hell at 3am

Python 3.13
/tool/python-3.13/team-migration-strategy
87%
tool
Similar content

CPython: The Standard Python Interpreter & GIL Evolution

CPython is what you get when you download Python from python.org. It's slow as hell, but it's the only Python implementation that runs your production code with

CPython
/tool/cpython/overview
74%
tool
Similar content

Python 3.13 Performance: Debunking Hype & Optimizing Code

Get the real story on Python 3.13 performance. Learn practical optimization strategies, memory management tips, and answers to FAQs on free-threading and memory

Python 3.13
/tool/python-3.13/performance-optimization-guide
72%
tool
Similar content

Python 3.13 SSL Changes & Enterprise Compatibility Analysis

Analyze Python 3.13's stricter SSL validation breaking production environments and the predictable challenges of enterprise compatibility testing and migration.

Python 3.13
/tool/python-3.13/security-compatibility-analysis
68%
tool
Similar content

Bun Production Optimization: Deploy Fast, Monitor & Fix Issues

Master Bun production deployments. Optimize performance, diagnose and fix common issues like memory leaks and Docker crashes, and implement effective monitoring

Bun
/tool/bun/production-optimization
57%
tool
Similar content

pyenv-virtualenv Production Deployment: Best Practices & Fixes

Learn why pyenv-virtualenv often fails in production and discover robust deployment strategies to ensure your Python applications run flawlessly. Fix common 'en

pyenv-virtualenv
/tool/pyenv-virtualenv/production-deployment
55%
tool
Similar content

Celery: Python Task Queue for Background Jobs & Async Tasks

The one everyone ends up using when Redis queues aren't enough

Celery
/tool/celery/overview
55%
tool
Similar content

Python 3.12 Migration Guide: Faster Performance, Dependency Hell

Navigate Python 3.12 migration with this guide. Learn what breaks, what gets faster, and how to avoid dependency hell. Real-world insights from 7 app upgrades.

Python 3.12
/tool/python-3.12/migration-guide
55%
tool
Similar content

Anypoint Code Builder Troubleshooting Guide & Fixes

Troubleshoot common Anypoint Code Builder issues, from installation failures and runtime errors to deployment problems and DataWeave/AI integration challenges.

Anypoint Code Builder
/tool/anypoint-code-builder/troubleshooting-guide
53%
howto
Similar content

FastAPI Kubernetes Deployment: Production Reality Check

What happens when your single Docker container can't handle real traffic and you need actual uptime

FastAPI
/howto/fastapi-kubernetes-deployment/production-kubernetes-deployment
50%
tool
Similar content

Django Troubleshooting Guide: Fix Production Errors & Debug

Stop Django apps from breaking and learn how to debug when they do

Django
/tool/django/troubleshooting-guide
50%
tool
Similar content

LM Studio Performance: Fix Crashes & Speed Up Local AI

Stop fighting memory crashes and thermal throttling. Here's how to make LM Studio actually work on real hardware.

LM Studio
/tool/lm-studio/performance-optimization
48%
tool
Similar content

pandas Overview: What It Is, Use Cases, & Common Problems

Data manipulation that doesn't make you want to quit programming

pandas
/tool/pandas/overview
48%
tool
Similar content

Pyenv Overview: Master Python Version Management & Installation

Switch between Python versions without your system exploding

Pyenv
/tool/pyenv/overview
48%
howto
Similar content

Pyenv: Master Python Versions & End Installation Hell

Stop breaking your system Python and start managing versions like a sane person

pyenv
/howto/setup-pyenv-multiple-python-versions/overview
48%
tool
Similar content

Python 3.12 New Projects: Setup, Best Practices & Performance

Master Python 3.12 greenfield development. Set up new projects with best practices, optimize performance, and choose the right frameworks for fresh Python 3.12

Python 3.12
/tool/python-3.12/greenfield-development-guide
48%

Recommendations combine user behavior, content similarity, research intelligence, and SEO optimization