Search code examples
pythonpipanacondapandas-datareader

VS Code : ModuleNotFoundError: No module named 'pandas_datareader'


I followed Microsoft's tutorial https://code.visualstudio.com/docs/python/data-science-tutorial and installed miniconda, I use it's python interpretor, and tried to import the following :

import math
import pandas_datareader as web
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler

However pandas_datareader won't be recognized, but is already installed as it says "requirements already satisfied" when I try to add it from either conda or pip. I don't get why my virtual environnement won't find it after browsing the web for hours, with no luck.

enter image description here


Solution

  • By default all the installations you do will be in base environment and not in the virtual environment.

    You'll have to activate the virtual environment in conda and then do a pip list to check if the package is present:

    conda activate your_env_name
    pip list
    

    If it's not present, then install it here and try it out. Should work fine.