Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python & requests | ImportError: No module named util

I just installed the package requests on a new computer. I'm getting this error when I try to import that module. Any ideas what's causing the issue w/ the util module?

Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) 

[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> import requests

Traceback (most recent call last):

File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.3.0-py2.7.egg/requests/__init__.py", line 58, in <module>
  from . import utils
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.3.0-py2.7.egg/requests/utils.py", line 25, in <module>
  from .compat import parse_http_list as _parse_list_header
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.3.0-py2.7.egg/requests/compat.py", line 7, in <module>
  from .packages import chardet
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.3.0-py2.7.egg/requests/packages/__init__.py", line 3, in <module>
  from . import urllib3
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.3.0-py2.7.egg/requests/packages/urllib3/__init__.py", line 16, in <module>
  from .connectionpool import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.3.0-py2.7.egg/requests/packages/urllib3/connectionpool.py", line 36, in <module>
  from .connection import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.3.0-py2.7.egg/requests/packages/urllib3/connection.py", line 43, in <module>
  from .util import (
ImportError: No module named util
like image 847
shartshooter Avatar asked Feb 13 '23 02:02

shartshooter


1 Answers

on pypi.python.org I see, that latest version of requests is 2.2.1

Your listing shows, you have installed version 2.3.0, so it is likely, you are using development version which is not yet really completed.

Uninstal it:

$ pip uninstall requests

And install production quality one:

$ pip install requests

In case, it would still mess up with version 2.3.0, install explicitly the 2.2.1

$ pip install requests==2.2.1
like image 68
Jan Vlcinsky Avatar answered Feb 16 '23 03:02

Jan Vlcinsky