Pip seems to have broken all of a sudden in my virtual environment (venv). When running any pip command, (like pip install --upgrade pip), I get the following error:
Traceback (most recent call last):
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper
status = run_func(*args)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
return func(self, options, args)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 339, in run
requirement_set = resolver.resolve(
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 94, in resolve
result = self._result = resolver.resolve(
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 348, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__
return bool(self._sequence)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
return any(self)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 44, in _iter_built
for version, func in infos:
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 294, in iter_index_candidate_infos
result = self._finder.find_best_candidate(
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 868, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 809, in find_all_candidates
page_candidates = list(page_candidates_it)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/index/sources.py", line 134, in page_candidates
yield from self._candidates_from_page(self._link)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 769, in process_project_url
html_page = self._link_collector.fetch_page(project_url)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 604, in fetch_page
return _get_html_page(location, session=self.session)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 509, in _get_html_page
resp = _get_html_response(url, session=session)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 125, in _get_html_response
resp = session.get(
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 542, in get
return self.request('GET', url, **kwargs)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_internal/network/session.py", line 454, in request
return super().request(method, url, *args, **kwargs)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/adapter.py", line 57, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/requests/adapters.py", line 413, in send
conn = self.get_connection(request.url, proxies)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/requests/adapters.py", line 316, in get_connection
conn = self.poolmanager.connection_from_url(url)
File "/home/user/code/home-stuff/.venv/lib/python3.10/site-packages/pip/_vendor/urllib3/poolmanager.py", line 299, in connection_from_url
u.host_ip, port=u.port, scheme=u.scheme, pool_kwargs=pool_kwargs
AttributeError: 'Url' object has no attribute 'host_ip'
I'm running linux mint 21 with Python 3.10. Not sure what caused this issue as the only changes I've made recently were system updates (via apt upgrade).
After poking around for a bit and trying a few things, I deleted my virtual environment (rm -rf .venv) and recreated it via python -m venv .venv.
Related
I cannot install the package in projects that were created anywhere other than the PyCharmProjects folder. I tried to create projects on the desktop both through PyCharm and without it, the result is the same just endless loading. But if you create in the PyCharmProjects folder, then no problem.
P.s in all projects had a virtual environment (venv)
Example:
pip install aiogram
ERROR: Operation cancelled by user
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\tempfile.py", line 252, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
PermissionError: [Errno 13] Permission denied: 'c:\\users\\ali\\appdata\\local\\pip\\cache\\http\\a\\1\\9\\5\\3\\a19537d3cf37c122db841d6fe4cd322bc10d1a558bb00d146b85cb9a4mlo_4p9.tmp'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\Scripts\pip.exe\__main__.py", line 7, in <module>
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\cli\main.py", line 70, in main
return command.main(cmd_args)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\cli\base_command.py", line 98, in main
return self._main(args)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\cli\base_command.py", line 214, in _main
self.handle_pip_version_check(options)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\cli\req_command.py", line 147, in handle_pip_version_check
pip_self_version_check(session, options)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\self_outdated_check.py", line 152, in pip_self_version_check
best_candidate = finder.find_best_candidate("pip").best_candidate
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\package_finder.py", line 851, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\package_finder.py", line 798, in find_all_candidates
page_candidates = list(page_candidates_it)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\sources.py", line 134, in page_candidates
yield from self._candidates_from_page(self._link)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\package_finder.py", line 758, in process_project_url
html_page = self._link_collector.fetch_page(project_url)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\collector.py", line 490, in fetch_page
return _get_html_page(location, session=self.session)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\collector.py", line 400, in _get_html_page
resp = _get_html_response(url, session=session)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\collector.py", line 115, in _get_html_response
resp = session.get(
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\requests\sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\network\session.py", line 454, in request
return super().request(method, url, *args, **kwargs)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 53, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\requests\adapters.py", line 533, in send
return self.build_response(request, resp)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 79, in build_response
cached_response = self.controller.update_cached_response(
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\cachecontrol\controller.py", line 374, in update_cached_response
self.cache.set(cache_url, self.serializer.dumps(request, cached_response))
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\network\cache.py", line 61, in set
with adjacent_tmp_file(path) as f:
File "C:\Program Files\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\utils\filesystem.py", line 82, in adjacent_tmp_file
with NamedTemporaryFile(
File "C:\Program Files\Python310\lib\tempfile.py", line 549, in NamedTemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "C:\Program Files\Python310\lib\tempfile.py", line 252, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
KeyboardInterrupt
On a Windows machine, there are a lot of reasons that a pip install can fail (Windows doesn't allow some programs to access to some files). You may have to give admin permissions to the terminal you are using.
When I was trying to install PyQt5 on Windows 10, I got the following error:
C:\Users\USER_NAME>pip install PyQt5
ERROR: Exception:
Traceback (most recent call last):
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\cli\base_command.py", line 180, in _main
status = self.run(options, args)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
return func(self, options, args)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\commands\install.py", line 318, in run
requirement_set = resolver.resolve(
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 127, in resolve
result = self._result = resolver.resolve(
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 473, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 341, in resolve
name, crit = self._merge_into_criterion(r, parent=None)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _merge_into_criterion
if not criterion.candidates:
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 139, in __bool__
return bool(self._sequence)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in __bool__
return any(self)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 129, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 30, in _iter_built
for version, func in infos:
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 269, in iter_index_candidate_infos
result = self._finder.find_best_candidate(
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\index\package_finder.py", line 879, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\index\package_finder.py", line 824, in find_all_candidates
page_candidates = list(page_candidates_it)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\index\sources.py", line 134, in page_candidates
yield from self._candidates_from_page(self._link)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\index\package_finder.py", line 783, in process_project_url
html_page = self._link_collector.fetch_page(project_url)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\index\collector.py", line 512, in fetch_page
return _get_html_page(location, session=self.session)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\index\collector.py", line 422, in _get_html_page
resp = _get_html_response(url, session=session)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\index\collector.py", line 120, in _get_html_response
resp = session.get(
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\requests\sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_internal\network\session.py", line 449, in request
return super().request(method, url, *args, **kwargs)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 53, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\urllib3\connection.py", line 359, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\urllib3\connection.py", line 500, in _connect_tls_proxy
return ssl_wrap_socket(
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "c:\users\andrew\appdata\local\programs\python\python39\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "c:\users\andrew\appdata\local\programs\python\python39\lib\ssl.py", line 997, in _create
raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
I have tried all the methods on this link and none of them helps. What could be the problem here? I have spent a lot of time on this. Thank you so much!!!
I don't have a proxy server on my system, does it matter? It might not be the problem of PyQt5. It might be the problem of my system.
I would try downloading anaconda, it has the pyQt5 environment, also when downloading / installing, make sure you click the update path option.
Go through these below, but it'd also be helpful if you could verify that you have pip installed correctly with pip -V.
https://www.geeksforgeeks.org/how-to-install-pip-on-windows/
https://stackoverflow.com/a/44232032/12406158
I have been using spyder for last three years, and just moved on to Visual Studio Code.
VSC is recommending me to install pylint, but my cmd outputs this.
C:\WINDOWS\system32>pip install pylint
ERROR: Exception:
Traceback (most recent call last):
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in _main
status = self.run(options, args)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\req_command.py", line 185, in wrapper
return func(self, options, args)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\commands\install.py", line 332, in run
requirement_set = resolver.resolve(
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 179, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 362, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 313, in _get_abstract_dist_for
self._populate_link(req)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 279, in _populate_link
req.link = self.finder.find_requirement(req, upgrade)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\index\package_finder.py", line 900, in find_requirement
best_candidate_result = self.find_best_candidate(
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\index\package_finder.py", line 883, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\index\package_finder.py", line 827, in find_all_candidates
package_links = self.process_project_url(
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\index\package_finder.py", line 792, in process_project_url
html_page = self._link_collector.fetch_page(project_url)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\index\collector.py", line 612, in fetch_page
return _get_html_page(location, session=self.session)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\index\collector.py", line 451, in _get_html_page
resp = _get_html_response(url, session=session)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\index\collector.py", line 149, in _get_html_response
resp = session.get(
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\requests\sessions.py", line 543, in get
return self.request('GET', url, **kwargs)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\network\session.py", line 421, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\requests\sessions.py", line 520, in request
settings = self.merge_environment_settings(
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\requests\sessions.py", line 697, in merge_environment_settings
env_proxies = get_environ_proxies(url, no_proxy=no_proxy)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\requests\utils.py", line 766, in get_environ_proxies
if should_bypass_proxies(url, no_proxy=no_proxy):
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\requests\utils.py", line 750, in should_bypass_proxies
bypass = proxy_bypass(parsed.hostname)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\requests\utils.py", line 96, in proxy_bypass
return proxy_bypass_registry(host)
File "c:\users\newsk\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\requests\utils.py", line 61, in proxy_bypass_registry
proxyEnable = int(winreg.QueryValueEx(internetSettings,
ValueError: invalid literal for int() with base 10: b'\x00\x00\x00\x00'
I had a similar message last time when I tried to install tensorflow using pip.
Can anybody help me with this issue?
Thanks.
When trying to pip install any package (specifically, right now, gspread)...
Full message I get is:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 305, in run
wb.build(autobuilding=True)
File "/Library/Python/2.7/site-packages/pip/wheel.py", line 705, in build
self.requirement_set.prepare_files(self.finder)
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 334, in prepare_files
functools.partial(self._prepare_file, finder))
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 321, in _walk_req_to_install
more_reqs = handler(req_to_install)
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 409, in _prepare_file
req_to_install, finder)
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 365, in _check_skip_installed
finder.find_requirement(req_to_install, self.upgrade)
File "/Library/Python/2.7/site-packages/pip/index.py", line 486, in find_requirement
all_versions = self._find_all_versions(req.name)
File "/Library/Python/2.7/site-packages/pip/index.py", line 404, in _find_all_versions
index_locations = self._get_index_urls_locations(project_name)
File "/Library/Python/2.7/site-packages/pip/index.py", line 378, in _get_index_urls_locations
page = self._get_page(main_index_url)
File "/Library/Python/2.7/site-packages/pip/index.py", line 818, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/Library/Python/2.7/site-packages/pip/index.py", line 928, in get_page
"Cache-Control": "max-age=600",
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/sessions.py", line 477, in get
return self.request('GET', url, **kwargs)
File "/Library/Python/2.7/site-packages/pip/download.py", line 373, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/Library/Python/2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/adapters.py", line 370, in send
timeout=timeout
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 344, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 314, in _raise_timeout
if 'timed out' in str(err) or 'did not complete (read)' in str(err): # Python 2.6
TypeError: __str__ returned non-string (type Error)
I am running high sierra,
which pip = /usr/local/bin/pip
python = 2.7.1
I am still new to python and this is my first time using it on this machine. I have googled a lot of different variations of this problem and am unable to figure out what I am doing wrong.
Sorry for such a simple question but any help would be appreciated. Thanks
Description
There is no error when clone by http, the error only meet when clone by https.
Env
Install Mercurial by mercurial-1.9.1+20110801-py2.6-macosx10.6.mpkg from http://mercurial.berkwood.com/binaries/Mercurial-1.9.1-py2.6-macosx10.6.zip
site-packages location: /Library/Python/2.6/site-packages
Command:
hg clone https://code.google.com/p/cooliris-toolkit/
Error Info
hg clone https://code.google.com/p/cooliris-toolkit/
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)]
** Mercurial Distributed SCM (version 1.9.1+20110801)
** Extensions loaded:
Traceback (most recent call last):
File "/usr/local/bin/hg", line 38, in
mercurial.dispatch.run()
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 27, in run
sys.exit(dispatch(request(sys.argv[1:])))
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 64, in dispatch
return _runcatch(req)
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 87, in _runcatch
return _dispatch(req)
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 679, in _dispatch
cmdpats, cmdoptions)
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 454, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 733, in _runcommand
return checkargs()
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 687, in checkargs
return cmdfunc()
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 676, in
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/Library/Python/2.6/site-packages/mercurial/util.py", line 385, in check
return func(*args, **kwargs)
File "/Library/Python/2.6/site-packages/mercurial/commands.py", line 1041, in clone
branch=opts.get('branch'))
File "/Library/Python/2.6/site-packages/mercurial/hg.py", line 217, in clone
srcrepo = repository(remoteui(ui, peeropts), source)
File "/Library/Python/2.6/site-packages/mercurial/hg.py", line 93, in repository
repo = _peerlookup(path).instance(ui, path, create)
File "/Library/Python/2.6/site-packages/mercurial/httprepo.py", line 231, in instance
inst._fetchcaps()
File "/Library/Python/2.6/site-packages/mercurial/httprepo.py", line 56, in _fetchcaps
self.caps = set(self._call('capabilities').split())
File "/Library/Python/2.6/site-packages/mercurial/httprepo.py", line 164, in _call
fp = self._callstream(cmd, **args)
File "/Library/Python/2.6/site-packages/mercurial/httprepo.py", line 114, in _callstream
resp = self.urlopener.open(req)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 383, in open
response = self._open(req, data)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 401, in _open
'_open', req)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 361, in _call_chain
result = func(*args)
File "/Library/Python/2.6/site-packages/mercurial/url.py", line 352, in https_open
return self.do_open(self._makeconnection, req)
File "/Library/Python/2.6/site-packages/mercurial/keepalive.py", line 256, in do_open
self._start_transaction(h, req)
File "/Library/Python/2.6/site-packages/mercurial/url.py", line 342, in _start_transaction
return keepalive.KeepAliveHandler._start_transaction(self, h, req)
File "/Library/Python/2.6/site-packages/mercurial/keepalive.py", line 354, in _start_transaction
h.endheaders()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 868, in endheaders
self._send_output()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 740, in _send_output
self.send(msg)
File "/Library/Python/2.6/site-packages/mercurial/url.py", line 129, in _sendfile
orgsend(self, data)
File "/Library/Python/2.6/site-packages/mercurial/keepalive.py", line 537, in safesend
self.connect()
File "/Library/Python/2.6/site-packages/mercurial/url.py", line 331, in connect
sslutil.validator(self.ui, host)(self.sock)
File "/Library/Python/2.6/site-packages/mercurial/sslutil.py", line 97, in __call__
msg = _verifycert(sock.getpeercert(), host)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ssl.py", line 157, in getpeercert
return self._sslobj.peer_certificate(binary_form)
AttributeError: 'NoneType' object has no attribute 'peer_certificate'
Question
How can I resolve the error ? Is there any conflict in python libraries ?
After I installed Mercurial (version 1.9.3), I encountered the same problem with Sailing, when I hg clone https://code.google.com/p/vim/
And my solution is:
hg clone http://code.google.com/p/vim/
I guess Mercurial 1.9.3
sslutil.py has bug in line 105:
peercert = sock.getpeercert(True)