0

I was trying to work with ipynb in VS Code. I tried importing pandas, numpy and some other modules but each of the time it throws an error "Module not found" even though they are all installed. Although when I launch same directory in jupyter notebook then it didn't cause any problem.

Can someone please suggest a way to deal with this problem? And it would be great if you suggest something without using Virtual Environment. Jupter image

    VS code: 
    ModuleNotFoundError                       Traceback (most recent call last)
    Cell In[2], line 1
    ----> 1 import torch
    ModuleNotFoundError: No module named 'torch'

I tried looking on Stackoverflow but none of the methods gives solution without involving virtual environment.

  • when you open ipynb in vscode, try checking which kernel are you using, there is a button on top right which will say "Select Kernel" if no kernel is selected, else it will display which python version and environment is being used, example: base(Python 3.10.9). Try clicking on this button and select the correct python version which has libraries installed – manjy Jul 06 '23 at 12:50
  • it is provable the a version mis-match. check that you are running the python for which the installs are done on. – D.L Jul 06 '23 at 13:43
  • @manjy Thanks a ton. The kernel was already selected, but changing it to another kernel made the program run! Thanks again. – Shubham Prakash Jul 07 '23 at 08:55

0 Answers0