Reputation: 169
I am trying to use this API for the Federal Reserve Economic Data (FRED): https://github.com/zachwill/fred
I installed the three modules that the documentation said are required. I get this error:
import fred
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import fred
File "build\bdist.win32\egg\fred\__init__.py", line 1, in <module>
# Dummy file to make this a package.
File "build\bdist.win32\egg\fred\fred.py", line 21, in <module>
ImportError: cannot import name xml2dict
I then installed xml2dict and installed fred again. When I now do import xml2dict first and then import fred, I get the exact same error.
I had a hard time learning to install modules in Python but thought I finally had it figured out. I can't seem to find what I am doing wrong here though and could use some help. Thanks!
For Zach: This is the problem I'm currently having:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
fred.series('GNPCA')
File "build\bdist.win32\egg\fred\api.py", line 90, in series
return Fred().series(path, **kwargs)
File "build\bdist.win32\egg\fred\core.py", line 100, in series
return self.get('series', path, **kwargs)
File "build\bdist.win32\egg\fred\core.py", line 36, in get
request = requests.get(url, params=params)
File "C:\Python26\lib\site-packages\requests-0.13.2-py2.6.egg\requests\api.py", line 54, in get
return request('get', url, **kwargs)
File "C:\Python26\lib\site-packages\requests-0.13.2-py2.6.egg\requests\safe_mode.py", line 37, in wrapped
return function(method, url, **kwargs)
File "C:\Python26\lib\site-packages\requests-0.13.2-py2.6.egg\requests\api.py", line 42, in request
return s.request(method=method, url=url, **kwargs)
File "C:\Python26\lib\site-packages\requests-0.13.2-py2.6.egg\requests\sessions.py", line 230, in request
r.send(prefetch=prefetch)
File "C:\Python26\lib\site-packages\requests-0.13.2-py2.6.egg\requests\models.py", line 601, in send
raise ConnectionError(e)
ConnectionError: HTTPConnectionPool(host='api.stlouisfed.org', port=80): Max retries exceeded with url: /fred/series?series_id=GNPCA&api_key=
Upvotes: 1
Views: 3115
Reputation: 4691
I'm the developer of the fred
package. This is completely my fault — I had the setup.py
file incorrectly configured, and I just pushed an update that should take care of this issue. Sorry for the confusion!
Upvotes: 4
Reputation: 142176
Tips on Installing modules in general:
What's generally easiest is to use pip
or easy_install
(or a binary installer if available) - that way all you need to do is easy_install fred
and everything will automatically be downloaded that's required (as long as it's been configured properly).
Check out setuptools at http://pypi.python.org/pypi/setuptools and install that for your appropriate OS version. You will then get a command called easy_install
which will be installed in a certain location depending on your OS/setup (the docs do mention where though).
[You can also easy_install pip
as pip
is effectively easy_install
's successor]
Then hopefully, all you need to do is easy_install fred
(which will automatically find at http://pypi.python.org/pypi/fred), and it will download the latest version and all dependencies for you. Fire up your interpreter and import fred
should "just work".
Upvotes: 3