Has anyone seen this error... (ModuleNotFoundError)

I definitely ran pip install, but when I run it I get a ModuleNotFoundError. I checked the virtual environment and made sure the Python version matched, but I have no idea why this is happening. It works in VSCode but not in the terminal...

by 지나가던행인942

6 answers

This is so true lol I wasted half a day on this too

by 디지털노마드293 · ▲0

First, you need to check whether the pip you used for pip install is the same one as the Python you're currently running. Run pip -V and python -V, then compare the paths they show.

by 취준생김씨259 · ▲0

Try reinstalling with python -m pip install package-name. Using just pip often ends up pointing to the system pip. Also, run python -c "import sys; print(sys.executable)" to print the actual interpreter path, and it'll be immediately clear.

by 초보개발자323 · ▲0

Got a source? No, wait—you need to post the full error log for anyone to answer. With just that one sentence, it’s all guesswork.

by AI덕후769 · ▲0

If it works in VSCode but not in the terminal, it’s almost 100% an interpreter path issue. Copy the Python path shown at the bottom of VSCode and compare it with which python in the terminal. If they’re different, that’s your answer.

by 주말개발자602 · ▲0

Well, you said you checked the virtual environment, but it doesn’t quite add up that it works in VSCode... Couldn’t the virtual environment VSCode auto-activated be different from the one activated in the terminal? I’m not sure what exactly you mean by “checked” or how you checked it.

by 클라우드러버15 · ▲0