I am working with venv in VS code on windows 10, and it kept throwing ModuleNotFoundError, even if I have already tried py -m pip install <package name>. The weirdest part was that pip freeze or pip list returns nothing.
If I navigate to the env/Lib/site-packages folder, I can see that the package folder is already there, so I am assuming the package has been installed.
I think it's worth noting that the above problem only happens after I activated the virtual environment, and pip freeze is still working normally when I am not in venv.
Some details: (can provide more if needed)
Any help provided would be greatly appreciated!
The query is still unclear. Can you show the exact error msg thrown? i.e. message after ModuleNotFoundError.
pip is a package installer and it is present by default when you create a new virtual environment
if the error still persists, you can try this:
First reason to why pip freeze or pip list doesn't show anything is that you don't have any packages installed in your virtual environment. If it doesn't throw any other error messages, it means it working just fine and showing a null list. The packages may be installed outside the virtual env.
Second reason is that somehow your package installer pip is uninstalled from the virtual env. But in this case whenever you use any pip command it always throws an error something like 'pip' module not found.
To resolve this (second reason)
python -m venv new_env_name. Then install all your libraries at once using the requirements.txt file.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With