0

I am trying to run a python(3.9.0) code in Jupyter Notebook in VScode .Even though I installed pandas in my virtual environment ,it still shows ModuleNotFoundError: No module named 'pandas' . I tried python3 -m pip install pandas ,it shows Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases. I installed pandas again using pip3 install pandas ,then it shows requirement already satisfied .But I am still getting ModuleNotFoundError

import pandas as pd
from pandas import Series,DataFrame
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
import numpy as np

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
c:\Users\hp\newtest\pcancer.ipynb Cell 1' in <cell line: 1>()
----> 1 import pandas as pd
      2 from pandas import Series,DataFrame
      3 import matplotlib.pyplot as plt

ModuleNotFoundError: No module named 'pandas'
Devika
  • 135
  • 1
  • 11
  • If you don't care to sort out why, try running in a cell in your notebook `%pip install pandas`. Once you establish it works, you can delete the cell. It may just be easier to install it in the environment backing the kernel that way than sort out why. Or is you are mainly using conda forget about pip, and try inside a cell in your notebook, `%conda install pandas`. It will do much the same as a I suggested earlier, yet using conda. – Wayne Jun 12 '22 at 18:02

2 Answers2

0

If you use conda, you can find the way to solve that in this link

0

I had the same problem and fixed it by following steps: Step 1) Have Python update the kernel with python: write in command window -m ipykernel install --user Step 2) afterwards type pip install pandas

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 09 '23 at 13:12