No module named pandas_datareader

138.8k views Asked by At

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?

17

There are 17 answers

2
Axis On

Type into Terminal:

pip install pandas_datareader

That's it

0
nwitte On

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

0
mcfroob On

Go to C:\Users\[UserName]\AppData\Roaming\jupyter\kernels\python3 and open up kernel.json. Check the first argument is pointing to a Python 3 environment/the environment you installed pandas_datareader to.

0
M_M On

In your Anaconda Prompt, do this : pip install pandas_datareader

0
Bepasha On

if you facing this error ,you have have to install pandas_datareader. you can install this package by Jupyter notebook also. "pip install pandas_datareader"

enter image description here

2
Quantum Prophet On

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
1
Trevor Weir On

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.

0
DhruvStan7 On

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

0
RocqJones On

You may consider upgrading your pandas with:

pip3 install --upgrade pandas
1
Camal Ahmadov On

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.

1
Solomon Megerssa On

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.

0
Emma On

This problem also bothers me constantly. But this method will usually solve it.

Open the [setting] window and then find [python interpreter]. Click on the + mark on top of the many packages names. Then use the search function to find the package you need, install it, and import it in the code.

0
GaginangDavid On

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.

0
sagar On

I was facing same problem which was solved when I ran this code on the conda terminal:

conda install pandas-datareader

I don't know why it was not working but this solved my problem.

1
Hunting On

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.

0
Matt Anderson On

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'.

0
Jason Wong On

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.