Attribute error: module 'requests' has no attribute 'Session' in pandas-DataReader

Viewed 1631

I am trying to follow this tutorial. However the line:

portfolio = web.DataReader(name=symbol, data_source='quandl', start=start, end=end)

is causing errors. After looking at the documentation, I have converted it to:

portfolio = pdr.DataReader(name=symbol, data_source='quandl', start=start, end=end)

but I still get the same error:
AttributeError: module 'requests' has no attribute 'Session'

this is being called from: "/home/john/.conda/envs/optimizer/lib/python3.8/site-packages/pandas_datareader/_utils.py"


Also fails the same as this question. (Question closed with no solution)

Recreate

conda install pandas
conda install -c anaconda pandas-datareader

$ python
>>> import requests
>>> requests.Session()

AttributeError: module 'requests' has no attribute 'Session'

According to this request, that should work, but it does not. I think the error is with requests, not with pandas-datareader.


Edit :: added more information

1 Answers

check your spelling.

It should have been requests.session() not requests.Session()

Related