No module named pandas_datareader

Viewed 112866

I have just installed pandas_datareader using pip install pandas-datareader which ran successfully.

Now I am trying to use it for a tutorial and I am getting this error when I try to import.

    import pandas_datareader as pdr

ModuleNotFoundError: No module named 'pandas_datareader'

This is the link to the tutorial.

https://www.datacamp.com/community/tutorials/finance-python-trading#gs.DgsO1BY

Any ideas?

14 Answers

Ok the following steps resolved the "No module named 'pandas_datareader" issue for me. To be clear, my situation was such that I had already installed pandas_datareader via pip install pandas_datareader but the "No module named 'pandas_datareader" error still kept popping up whenever I ran a .py code that imports pandas_datareader.

If you are in the same situation as I was (on Mac), this may help you.

Step 1: Uninstall the pandas_datareader package first:

  • via terminal, type pip uninstall pandas_datareader
  • it will prompt you asking for a y/n answer to proceed with the uninstallation
  • type 'y'

Step 2: Restart your IDE if you were using one

  • in my case, I was using MS VSC (Visual Studio Code)

Step 3:: re-install pandas_datareader package

  • again via terminal, type pip install pandas_datareader

  • your terminal may show you a bunch of "pre-installed" pandas_datareader package with message "Requirement already satisfied..."

  • ignore those.

Step 4: Run your python code again

  • the "No module named 'pandas_datareader" error should be gone this time round.

Hope this helps.

All the other methods didn't work for me.

In command prompt: conda install -c delichon pandas_datareader

This is working fine on 22nd sept 2019 make sure to update pip.

For me, Import pandas_datareader worked from the command prompt while using python but did not work in jupyter.

From inside jupyter in a cell, I ran pip install pandas_datareader

I got a whole host of "Requirement already satisfied" messages

But at the very end, I was given this very important message. Successfully installed pandas-datareader-0.8.1 Note: you may need to restart the kernel to use updated packages In Jupyter notebook.

There is a kernel menu command sitting between cell and widgets. The restart command is in that drop-down menu option. In my case, this restarting of the kernel was the solution to my " No module named 'pandas_datareader' " all along.

Had the same issue. This resolved it for me:

after activating the env, run:

pip install pip --upgrade
pip install pandas-datareader
pip install jupyter (as i was using a jupyter notebook)

However, if you are running anaconda, use:

conda install -c anaconda pandas-datareader

I had the same problem. I tried pip install pandas_datareader in my Anaconda Prompt and the problem was solved. For some reason, it didn't work in command prompt.

Got this error even though I had pandas_datareader installed. Running on Windows. py -3 -m pip install pandas_datareader in the command prompt didn't work. Same in anaconda prompt didn't work. pip uninstall pandas_datareader followed by pip install pandas_datareader and a reboot finally fixed my problem.

TLDR if running on a Windows machine, uninstall pandas_datareader if you have it (pip uninstall pandas_datareader) and then reinstall with 'pip install pandas_datareader'.

You may consider upgrading your pandas with:

pip3 install --upgrade pandas

I had the same issue installing through my terminal. Since I'm using Anaconda Navigator, I tried the CMD.exe Prompt and inputted "conda install -c conda-forge pandas-datareader".

Jupyter notebook now works like a charm.

I was having this same issue in Jupyter Notebook, where it wasnt recognizing pandas_datareader, even though it said that it was installed successfully in anaconda prompt.

I figured out that my jupyter notebook wasnt opening up in my environment. I activated my environment in Anaconda Prompt and then did conda install nb_conda_kernels. When I opened up Jupyter notebook and checked my env, I was in the correct one, and it recognized my pandas_datareader import. You can check your environment using:

import sys
print(sys.prefix)

This is a SO thread that helped me: Conda environments not showing up in Jupyter Notebook

I was having the same issue. I tried pip install pandas-datareader, pip install pandas_datareader, python3 -m pip install pandas_datareader on termianl, I see message saying I have successfully installed the package but none of them worked. I use Pycharm as my IDE and when I checked File-->Setting-->Progect:File-->Python interpreter, pandas-datareader is not in the package list. I use anaconda as my python Interpreter. So, just added the package into the interpreter and finally worked.

If you are facing this issue in Jupyter Notebook, just restart the kernel within the IDE. -Make sure u have installed pandas_datareader with "pip install pandas_datareader" -Click on the tab named 'kernel' -Click Restart

Your Problem will be resolved

Related