I have a bit of a weird issue that I couldn't find an answer to on Google. I'm trying to use Python on VSCode (quite new to it, I've been using PyCharm till now), but for some reason when I try to import and use Numpy or PyTorch, it throws a ModuleNotFoundError (see below).
I've double checked to ensure I've selected the right environment and that Numpy and PyTorch are both installed in this specific environment.
This code also works without issue in this environment if I try it on PyCharm, so the issue seems to be entirely in VSCode alone. Note, I'm using the
CodePudding user response:
The file is located on your desktop but the file should be somewhere where it has access to "python\Lib\site-packages" folder where numpy should be installed.
1.go to your folder where python is installed.
2.go to the folder called "scripts" and make a .py file in there, try to run the same code and if the "ModuleNotFoundError" isn't fixed yet.
3.reinstall numpy from the terminal in the file thats located in the scripts folder. I had the same issue but putting my file into the "scripts" folder fixed it for me.
If this dosent work just tell me. :^)
CodePudding user response:
Thanks all for your suggestions. Reinstalling everything (Conda and VSCode, as well as PyTorch) fixed the issue for me.