0

I am trying to execute the following code

from pandas_datareader import data, wb

but I am getting the error saying that

from requests.exceptions import ConnectionError, ConnectTimeout, ReadTimeout ImportError: cannot import name ConnectTimeout

I have already installed requests, pandas_datareader I am not sure where the problem is exactly. can someone help me on this?

I was trying to use Python shell aswell..

>>>import pandas_datareader

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pandas_datareader/__init__.py", line 3, in <module>
from .data import (get_components_yahoo, get_data_famafrench, get_data_google, get_data_yahoo, get_data_enigma,  # noqa
File "/usr/local/lib/python2.7/dist-packages/pandas_datareader/data.py", line 7, in <module>
from pandas_datareader.google.daily import GoogleDailyReader
File "/usr/local/lib/python2.7/dist-packages/pandas_datareader/google/daily.py", line 1, in <module>
from pandas_datareader.base import _DailyBaseReader
File "/usr/local/lib/python2.7/dist-packages/pandas_datareader/base.py", line 13, in <module>
from pandas_datareader._utils import (RemoteDataError, SymbolWarning,
File "/usr/local/lib/python2.7/dist-packages/pandas_datareader/_utils.py", line 10, in <module>
import requests_ftp
File "/usr/local/lib/python2.7/dist-packages/requests_ftp/__init__.py", line 21, in <module>
from .ftp import FTPAdapter, monkeypatch_session
File "/usr/local/lib/python2.7/dist-packages/requests_ftp/ftp.py", line 13, in <module>
from requests.exceptions import ConnectionError, ConnectTimeout,      ReadTimeout
ImportError: cannot import name ConnectTimeout
7
  • Where exactly in your code are you importing the modules from requests.exceptions? Jan 27, 2017 at 16:31
  • 1
    What version of requests module do you have? I guess you want to update your requests module... Jan 27, 2017 at 16:31
  • @Fruitspunchsamurai I am not using the modules from requests.exceptions yet. I was trying in normal python shell to check wether my imported package is working or not and I am stuck with this error.
    – Bhargav
    Jan 27, 2017 at 16:56
  • @MaxU requests==2.2.1 is the version I am using currently
    – Bhargav
    Jan 27, 2017 at 16:59
  • @Bhargav, actual version of requests is 2.12.4 - 2.13, version 2.2.1 ( Release date: 2014-01-23) - so it's a little bit outdated. ;-) And what is your pandas_reader.__version__? Jan 27, 2017 at 17:01

2 Answers 2

1

It looks like you have a pretty old version of request module.

Try to update it.

3
  • I have updated it too. But it was the same. I am using cloud9 for the development
    – Bhargav
    Jan 27, 2017 at 16:54
  • can you post an output of the following: import requests; print(requests.__version__)? NOTE: you should use the same environment where you were executing: from pandas_datareader import data, wb Jan 27, 2017 at 16:55
  • >>> import requests >>> print (requests.__version__) 2.2.1
    – Bhargav
    Jan 27, 2017 at 17:02
-2

I worked with the same requirements in normal virtualenv(with the same pip requirements) instead of working on cloud9. It worked. I guess this has something to do with the environmental platform.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.