No module named 'pandas_datareader' in Jupyter (Anaconda) after I run pip3 install pandas_datareader

▼魔方 西西 提交于 2021-02-09 09:21:50

问题


I am trying to learn pandas and want to load some stocks data. I was following a course which advised me to load pandas.io.data, but this did not work as io.data was depreciated. So I decided to use pandas-datareader instead. But I am struggling to instal it on mac in Anaconda (Jupiter notebook).

First time I run import pandas_datareader as pdweb I got ModuleNotFoundError: No module named 'pandas_datareader'. Not surprising as I never used this before so I run pip3 install pandas_datareader in Terminal which successfully installed itself. However, Jupiter notebook is still giving me the same error. At this point, I tried running in Terminal conda install -c https://conda.anaconda.org/anaconda pandas-datareader but it did not work as -bash: conda: command not found.

Please help. I am looking for a detailed explanation as I am not too techie.

What I run in Jupiter

import numpy as np
from pandas import Series, DataFrame
import pandas as pd
import pandas_datareader as pdweb 
import datetime

Result

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-6-da568f513c93> in <module>
      2 from pandas import Series, DataFrame
      3 import pandas as pd
----> 4 import pandas_datareader as pdweb
      5 import datetime

ModuleNotFoundError: No module named 'pandas_datareader'

回答1:


Just run

conda install -c anaconda pandas-datareader 

as per instructions here.

In my experience, if you're using conda, you should never install with pip unless you're sure conda doesn't have it. Try searching anaconda.org to see which -c source to use.




回答2:


The problem was with conda command not being set up during the installation of Anaconda. I solved this by removing Anaconda with App Cleaner & Uninstaller Pro (free soft) and reinstalling later version.

After reinstallation of Anaconda command below worked like a charm.

conda install -c anaconda pandas-datareader 



回答3:


For the install, try using

pip

instead of

pip3


来源:https://stackoverflow.com/questions/55323996/no-module-named-pandas-datareader-in-jupyter-anaconda-after-i-run-pip3-insta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!