pythonanacondajupyterpandas-datareader

Blocking issue with pandas_datareader in Anaconda - "conda install -c anaconda pandas-datareader" not fixing it


I have a blocking issue with pandas_datareader (Windows) installed with Anaconda/Jupyter. The solutions proposed in other StackOverflow posts are not working as following described.

This is a simple code for testing the datareader package

import pandas as pd
import numpy as np
from pandas_datareader.data import DataReader

and this is the error I get

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [1], in <cell line: 3>()
      1 import pandas as pd
      2 import numpy as np
----> 3 from pandas_datareader.data import DataReader
 
**ModuleNotFoundError: No module named 'pandas_datareader'**

As suggested in other Q&As here in StackOverflow I manually installed the datareader package with this command

conda install -c anaconda pandas-datareader

The process seemed to be completed successfully; as further verification, if I try to re-install it, I get a notification saying that "# All requested packages already installed."

I have tried to restart the kernel and also rebooted the system. The trouble is still there. I have also uninstalled pandas_datareader ("conda uninstall pandas-datareader") and reinstaleld it. Nothing. Any idea?

UPDATE 1

and this might be the problem. Any idea?


Solution

  • I found a post explaining how to install conda packages in a Jupyter notebook and it seems it has fixed the problem:

    import sys
    !conda install --yes --prefix {sys.prefix} pandas-datareader
    

    but I don't know why, so if anybody knows what happened and why this fixed the problem, an explanation in the remarks could be useful.