Skip to content
Advertisement

Python PIP giving error – “AttributeError: ‘module’ object has no attribute ‘ip_address'”

I am actually having a problem with installing any modules using PIP. Whenever I run PIP like

pip install module_name

OR

sudo pip install module-name

” then it’ll show an error like this:-

Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/commands/install.py", line 294, in run
    requirement_set.prepare_files(finder)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 334, in prepare_files
    functools.partial(self._prepare_file, finder))
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 321, in _walk_req_to_install
    more_reqs = handler(req_to_install)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 461, in _prepare_file
    req_to_install.populate_link(finder, self.upgrade)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 250, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/index.py", line 486, in find_requirement
    all_versions = self._find_all_versions(req.name)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/index.py", line 425, in _find_all_versions
    if self._validate_secure_origin(logger, link)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/index.py", line 301, in _validate_secure_origin
    addr = ipaddress.ip_address(
AttributeError: 'module' object has no attribute 'ip_address'

Importantly:-

AttributeError: 'module' object has no attribute 'ip_address

Reinstalling does nothing

Advertisement

Answer

I fixed it by using the following commands:

$ sudo easy_install --upgrade pip
...
Installed /usr/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

$ sudo pip uninstall requests
...
  Successfully uninstalled requests-1.1.0

$ sudo pip install requests
...
Successfully installed requests-2.12.4

$ pip install --upgrade pyOpenSSL
Advertisement