The command pip install fails with the error "ValueError: invalid literal for int() with base 10:"

Solution Verified - Updated -

Issue

  • When trying to install a module using pip install, it throws the traceback below:
(RHAT_NEW) [root@myhost pip]# pip install rpdb
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Exception:
Traceback (most recent call last):
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
    status = self.run(options, args)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 185, in wrapper
    return func(self, options, args)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 278, in run
    session = self.get_default_session(options)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 83, in get_default_session
    self._session = self.enter_context(self._build_session(options))
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 100, in _build_session
    index_urls=self._get_index_urls(options),
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/network/session.py", line 306, in __init__
    self.add_trusted_host(host, suppress_logging=True)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/network/session.py", line 322, in add_trusted_host
    host_port = parse_netloc(host)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 688, in parse_netloc
    return parsed.hostname, parsed.port
  File "/usr/lib64/python2.7/urlparse.py", line 112, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: ''
Traceback (most recent call last):
  File "/root/RHAT_NEW/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 75, in main
    return command.main(cmd_args)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 114, in main
    return self._main(args)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 226, in _main
    self.handle_pip_version_check(options)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 155, in handle_pip_version_check
    timeout=min(5, options.timeout)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 100, in _build_session
    index_urls=self._get_index_urls(options),
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/network/session.py", line 306, in __init__
    self.add_trusted_host(host, suppress_logging=True)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/network/session.py", line 322, in add_trusted_host
    host_port = parse_netloc(host)
  File "/root/RHAT_NEW/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 688, in parse_netloc
    return parsed.hostname, parsed.port
  File "/usr/lib64/python2.7/urlparse.py", line 112, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: ''

Environment

  • Red Hat Enterprise Linux 7
  • pip==20.1.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In