No module named pandas_datareader
Asked Answered
C

17

27

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?

Cerda answered 17/9, 2017 at 22:24 Comment(11)
You probably just installed the package for the wrong version of python. Make sure you are using the right pip. Usually the safest thing to do is to run: sudo python3 -m pip install pandas_datareader if you are trying to install the package for your python3 installation.Sergias
sorry using windows cmd so???? python3 -m pip install pandas_datareader??? can i use -upgrade to upgrade to 3x vers?Cerda
I wrongly assumed that you were on some form of unix machine (mac, ubuntu or what not). But you should be able to use the same command, except for the sudo prefix: python3 -m pip install pandas_datareader. You can use --upgrade to make sure you are getting the latest version of the package. Please don't assume that --upgrade is for upgrading python's version. It's mainly to make sure you are installing the latest version of the package.Sergias
my apologies for missing out the win info i tried that exact command 'python3 -m pip install pandas_datareader' and had a python not a recognised command errorCerda
this is bey0nd frustrating you would think 1: the tutorial would trole shoot this stuff for you without sending you to thirdparty website where you have to troll through Jupyter Entries to find a solution and more importantly 2:When using pip install pandas_datareaders it should just install the latest version for you and match to your version of python also . If you can build a complicated module at least put some effort into making it easy to install!!Cerda
C:\WINDOWS\system32>python3 -m pip install pandas_datareader 'python3' is not recognized as an internal or external command, operable program or batch file.Cerda
You need to find your python3 installation. I don't think anybody will do that for you. Also, if you choose to install a package, you should be comfortable with the idea that it is your responsibility to figure out how to install it. The fact that someone wrote an entire library and shared it with you is a true act of kindness.Sergias
That said, open spyder and run import sys; sys.executable. This should tell you where your python installation is. You can then use that path to call pip. Instead of python3 -m pip install pandas_datareade, you can replace python3 with the output of sys.executable.Sergias
I was getting the same error. The following command worked for me: pip3 install pandas_datareaderSliest
After updating my miniconda, I got the same error. I tried conda install, not available. I tried pip install, already installed. After a reboot of the machine, it is now back to work. Hope this helps!Cori
Guys, the command is right, the platform is wrong. For Python on Windows, the command is "python -m pip install pandas_datareader", not "python3..." or "pip3..." The suffix of "3" on python3 and pip3 is for Mac OS and Linux only.Exsanguinate
A
38

Type into Terminal:

pip install pandas_datareader

That's it

Allegory answered 17/9, 2017 at 22:36 Comment(2)
you would think it was that easy and assuming i havent googled it first is a bit rude.... Im getting this. ) Requirement already satisfied: pandas>=0.17.0 in c:\program files (x86)\python36\lib\site-packages (from pandas_datareader)Cerda
Do you mean pandas_datareader or actually pandas-datareader (underscore versus dash in the package name)?Suilmann
P
6

In your Anaconda Prompt, do this : pip install pandas_datareader

Papillon answered 7/12, 2017 at 18:43 Comment(0)
E
6

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.

Erase answered 15/5, 2019 at 14:0 Comment(0)
C
6

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.

Crenulation answered 14/5, 2020 at 9:37 Comment(1)
This worked for me too, but I had already tried restarting the kernel. The secret sauce was using the pip install in Jupyter Notebook, instead of at the cmd prompt.Careless
H
5

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.

Hezekiah answered 22/9, 2019 at 11:41 Comment(1)
This command gives me an PackagesNotFoundError. However, the official one from the conda web works: conda install -c anaconda pandas-datareaderAttica
B
4

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
Bradlybradman answered 31/3, 2020 at 21:37 Comment(2)
can you tell me what "conda install -c anaconda pandas-datareader"?Dafodil
About my previous commentary: ok, in the docs it shows that is for "Channel Customization". docs.conda.io/projects/conda/en/latest/commands/… Does it mean I'm choosing "Anaconda" as source to download pandas-datareader?Dafodil
M
1

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.

Mariannemariano answered 30/6, 2019 at 22:30 Comment(1)
OMG, i've been struggling with this for hours! Thank you! Your solution finally worked for me!Ignorant
U
1

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

Uranography answered 13/8, 2019 at 11:46 Comment(0)
L
1

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.

Limiter answered 29/10, 2020 at 8:24 Comment(0)
J
1

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

Joellenjoelly answered 1/6, 2021 at 17:8 Comment(0)
C
1

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.

Casady answered 8/10, 2023 at 3:40 Comment(0)
S
0

You may consider upgrading your pandas with:

pip3 install --upgrade pandas
Succubus answered 9/6, 2020 at 19:44 Comment(0)
C
0

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.

Capparidaceous answered 28/6, 2022 at 0:22 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Enwrap
T
0

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

Trina answered 29/11, 2022 at 23:3 Comment(0)
A
0

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.

Accommodative answered 20/3, 2023 at 14:57 Comment(0)
C
-1

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.

Cupp answered 28/11, 2017 at 11:51 Comment(0)
P
-1

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

Prisoner answered 29/5, 2020 at 3:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.