Menu

8 Python errors every beginner hits (and what they actually mean)
📰

8 Python errors every beginner hits (and what they actually mean)

#devcommunity#dev#python#enter#exit
Reading 0:00
15s threshold

These Python errors show up in nearly every beginner's first month, and in a fair number of senior engineers' CI logs. Each one has a short fix. Here's what it means and what to do.

1. ModuleNotFoundError: No module named 'requests'

You installed the package into a different Python than the one running your code.

python -m pip install requests # use the SAME python you run the script with python -c "import sys; print(sys.executable)"

Enter fullscreen mode

Exit fullscreen mode

In VS Code, check the interpreter in the status bar. If you use a virtualenv, activate it first ( source .venv/bin/activate ).

2. error: externally-managed-environment

New on Ubuntu 23.04+, Debian 12 and Homebrew Python. The OS won't let pip modify the system Python.

python3 -m venv .venv && source .venv/bin/activate pip install whatever

Enter fullscreen mode

Exit fullscreen mode

For command-line tools use pipx install <tool> . Avoid --break-system-packages unless you know what it breaks.

3.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.