Common causes
- The package isn't installed — you need to install it with pip
- You're running the script with a different Python/pip than the one where the package is installed
- A virtual environment is active but the package is installed in the global environment (or vice versa)
- Typo in the import name — package install names and import names sometimes differ (e.g. pip install Pillow but import PIL)
How to fix it
- Install the missing package: pip install <package-name>
- If using a virtual environment, activate it first: source venv/bin/activate (Mac/Linux) or venv\Scripts\activate (Windows)
- Verify you're using the correct pip: python -m pip install <package> (uses the same Python as your script)
- Check the import name — some packages use different names for install vs import
Example
Traceback (most recent call last):
File "app.py", line 1, in <module>
import requests
ImportError: No module named 'requests'Running a script that imports requests before running pip install requests
Have a different error?
Paste any error message into the Error Translator to get an instant explanation.
