PromtEngineer / PromtEngineer/localGPT

Backend fails with ModuleNotFoundError: No module named 'cgi'

Open
#854 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
22.2k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Looks like the code might be relying on the old python CGI module which was deprecated and removed from Python 3.13 onwards.

10:10:24 [SYSTEM] INFO: ✅ rag-api started successfully (PID: 28085)
10:10:24 [SYSTEM] INFO: 🔄 Starting backend on port 8000...
10:10:24 [BACKEND] INFO: Traceback (most recent call last):
10:10:24 [BACKEND] INFO: File "/Users/samm/localGPT/backend/server.py", line 4, in <module>
10:10:24 [BACKEND] INFO: import cgi
10:10:24 [BACKEND] INFO: ModuleNotFoundError: No module named 'cgi'
10:10:26 [SYSTEM] ERROR: ❌ backend failed to start
10:10:26 [SYSTEM] INFO: 🔄 Starting frontend on port 3000...
10:10:26 [FRONTEND] INFO: > multimodal_rag@0.1.0 dev
10:10:26 [FRONTEND] INFO: > next dev
10:10:29 [FRONTEND] INFO: ▲ Next.js 15.3.3
10:10:29 [FRONTEND] INFO: - Local:        http://localhost:3000
10:10:29 [FRONTEND] INFO: - Network:      http://192.168.0.223:3000
10:10:29 [FRONTEND] INFO: ✓ Starting...
10:10:30 [FRONTEND] INFO: ✓ Ready in 1334ms
10:10:31 [SYSTEM] INFO: ✅ frontend started successfully (PID: 28118)
10:10:31 [SYSTEM] ERROR: ❌ Failed to start required services: backend
10:10:31 [SYSTEM] ERROR: ❌ System startup failed
10:10:31 [SYSTEM] INFO: 🛑 Shutting down RAG system...
10:10:31 [SYSTEM] INFO: 🔄 Stopping frontend...
10:10:31 [FRONTEND] INFO:
10:10:31 [SYSTEM] INFO: ✅ frontend stopped
10:10:31 [SYSTEM] INFO: 🔄 Stopping backend...
10:10:31 [SYSTEM] INFO: ✅ backend stopped
10:10:31 [SYSTEM] INFO: 🔄 Stopping rag-api...
10:10:31 [SYSTEM] INFO: ✅ rag-api stopped
10:10:31 [SYSTEM] INFO: ✅ All services stopped

There is a temporary workaround of pip install legacy-cgi but the proper solution is probably to remove the dependency by refactoring the code that uses it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with backend/server.py, where the failing import is shown, and trace how the CGI module is used. Run the backend under Python 3.13 after refactoring that dependency; done means startup succeeds without installing legacy-cgi.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.