I'm trying to install the flake8 module for Python (in order to use the SublimeLinter-flake8 package to Sublime Text 3) but get an error message on install (below). What am I doing wrong here?
C:\Windows\system32>python -m pip install flake8
Collecting flake8
Exception:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 223, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 280, in run
requirement_set.prepare_files(finder)
File "C:\Python27\lib\site-packages\pip\req\req_set.py", line 317, in prepare_files
functools.partial(self._prepare_file, finder))
File "C:\Python27\lib\site-packages\pip\req\req_set.py", line 304, in _walk_req_to_install
more_reqs = handler(req_to_install)
File "C:\Python27\lib\site-packages\pip\req\req_set.py", line 439, in _prepare_file
req_to_install.populate_link(finder, self.upgrade)
File "C:\Python27\lib\site-packages\pip\req\req_install.py", line 244, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\Python27\lib\site-packages\pip\index.py", line 486, in find_requirement
all_versions = self._find_all_versions(req.name)
File "C:\Python27\lib\site-packages\pip\index.py", line 404, in _find_all_versions
index_locations = self._get_index_urls_locations(project_name)
File "C:\Python27\lib\site-packages\pip\index.py", line 378, in _get_index_urls_locations
page = self._get_page(main_index_url)
File "C:\Python27\lib\site-packages\pip\index.py", line 810, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Python27\lib\site-packages\pip\index.py", line 920, in get_page
"Cache-Control": "max-age=600",
File "C:\Python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 477, in get
return self.request('GET', url, **kwargs)
File "C:\Python27\lib\site-packages\pip\download.py", line 373, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "C:\Python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 605, in send
r.content
File "C:\Python27\lib\site-packages\pip\_vendor\requests\models.py", line 750, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
File "C:\Python27\lib\site-packages\pip\_vendor\requests\models.py", line 673, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "C:\Python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 307, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "C:\Python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 243, in read
data = self._fp.read(amt)
File "C:\Python27\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 54, in read
self.__callback(self.__buf.getvalue())
File "C:\Python27\lib\site-packages\pip\_vendor\cachecontrol\controller.py", line 244, in cache_response
self.serializer.dumps(request, response, body=body),
File "C:\Python27\lib\site-packages\pip\download.py", line 276, in set
return super(SafeFileCache, self).set(*args, **kwargs)
File "C:\Python27\lib\site-packages\pip\_vendor\cachecontrol\caches\file_cache.py", line 99, in set
with self.lock_class(name) as lock:
File "C:\Python27\lib\site-packages\pip\_vendor\lockfile\mkdirlockfile.py", line 18, in __init__
LockBase.__init__(self, path, threaded, timeout)
File "C:\Python27\lib\site-packages\pip\_vendor\lockfile\__init__.py", line 189, in __init__
hash(self.path)))
File "C:\Python27\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 9: ordinal not in range(128)
After startlingly generous help from Padraic, we eventually figured out that the problem was my computer name, which was Fredrik-Bärbar (notice the ä, i.e. 0xe4 in code page 850, there in the 10th place, or 9th place using Python's 0-based indexing).
(This error is related to that in Pip Error when installing, another question solved by Padraic.)
Related
Just moved to a new work computer and I seem to be getting the following error when I try to use pip. Wondering what the issue could be, python 3.7.2 on Windows 10.
Is it that my work password has characters that aren't allowed?
Strange because my older computer didn't have this issue.
Exception:
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\cli\base_command.py", line 143, in main
status = self.run(options, args)
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\commands\install.py", line 318, in run
resolver.resolve(requirement_set)
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\resolve.py", line 102, in resolve
self._resolve_one(requirement_set, req)
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\resolve.py", line 256, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\resolve.py", line 199, in _get_abstract_dist_for
skip_reason = self._check_skip_installed(req)
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\resolve.py", line 170, in _check_skip_installed
self.finder.find_requirement(req_to_install, upgrade=True)
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\index.py", line 572, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\index.py", line 530, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\index.py", line 675, in _get_pages
page = self._get_page(location)
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\index.py", line 793, in _get_page
return _get_html_page(link, session=self.session)
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\index.py", line 144, in _get_html_page
"Cache-Control": "max-age=0",
File "C:\Program Files\Python37\lib\site-packages\pip\_vendor\requests\sessions.py", line 525, in get
return self.request('GET', url, **kwargs)
File "C:\Program Files\Python37\lib\site-packages\pip\_internal\download.py", line 396, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "C:\Program Files\Python37\lib\site-packages\pip\_vendor\requests\sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "C:\Program Files\Python37\lib\site-packages\pip\_vendor\requests\sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "C:\Program Files\Python37\lib\site-packages\pip\_vendor\requests\adapters.py", line 410, in send
conn = self.get_connection(request.url, proxies)
File "C:\Program Files\Python37\lib\site-packages\pip\_vendor\requests\adapters.py", line 308, in get_connection
proxy_manager = self.proxy_manager_for(proxy)
File "C:\Program Files\Python37\lib\site-packages\pip\_vendor\requests\adapters.py", line 191, in proxy_manager_for
proxy_headers = self.proxy_headers(proxy)
File "C:\Program Files\Python37\lib\site-packages\pip\_vendor\requests\adapters.py", line 389, in proxy_headers
password)
File "C:\Program Files\Python37\lib\site-packages\pip\_vendor\requests\auth.py", line 63, in _basic_auth_str
password = password.encode('latin1')
UnicodeEncodeError: 'latin-1' codec can't encode character '\u201d' in position 0: ordinal not in range(256)
Oops I think I resolved it minutes later. The instructions for the environmental variable for the proxy server password included a "" that wasn't supposed to actually be in the environmental variable text.
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 I run pip install matplotlib or pip3 install matplotlib from my terminal, I get the following error. Can someone tell me why this is happening? I use ubuntu 16.04. Thanks in advance.
Collecting matplotlib
Exception:
Traceback (most recent call last):
File "/home/surya/.local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/surya/.local/lib/python3.5/site-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/home/surya/.local/lib/python3.5/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/home/surya/.local/lib/python3.5/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/home/surya/.local/lib/python3.5/site-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/home/surya/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/home/surya/.local/lib/python3.5/site-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/home/surya/.local/lib/python3.5/site-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/home/surya/.local/lib/python3.5/site-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/home/surya/.local/lib/python3.5/site-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/home/surya/.local/lib/python3.5/site-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/home/surya/.local/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File "/home/surya/.local/lib/python3.5/site-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/home/surya/.local/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/home/surya/.local/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "/home/surya/.local/lib/python3.5/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/home/surya/.local/lib/python3.5/site-packages/pip/_vendor/requests/adapters.py", line 390, in send
conn = self.get_connection(request.url, proxies)
File "/home/surya/.local/lib/python3.5/site-packages/pip/_vendor/requests/adapters.py", line 290, in get_connection
proxy_manager = self.proxy_manager_for(proxy)
File "/home/surya/.local/lib/python3.5/site-packages/pip/_vendor/requests/adapters.py", line 184, in proxy_manager_for
**proxy_kwargs
File "/home/surya/.local/lib/python3.5/site-packages/pip/_vendor/requests/adapters.py", line 43, in SOCKSProxyManager
raise InvalidSchema("Missing dependencies for SOCKS support.")
pip._vendor.requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.
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
i'm using python 2.7 on a windows 10.
iv'e tried to install openpyxl using "pip install openpyxl"
and iv'e got an trace of errors, ending in "UnicodeDecodeError: 'ascii' codec can't decode byte".
I searched this site for solutions, and i tried to upgrade pip, as suggested in one of them.
When i typed "pip install --upgrade pip" i got the same error (i pasted the error trace below).
C:\Users\Gal>pip install --upgrade pip
Exception:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\python27\lib\site-packages\pip\commands\install.py", line 299, in
run
requirement_set.prepare_files(finder)
File "c:\python27\lib\site-packages\pip\req\req_set.py", line 370, in
prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\python27\lib\site-packages\pip\req\req_set.py", line 458, in
_prepare_file
req_to_install, finder)
File "c:\python27\lib\site-packages\pip\req\req_set.py", line 407, in
_check_skip_installed
finder.find_requirement(req_to_install, self.upgrade)
File "c:\python27\lib\site-packages\pip\index.py", line 442, in
find_requirement
all_candidates = self.find_all_candidates(req.name)
File "c:\python27\lib\site-packages\pip\index.py", line 400, in
find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "c:\python27\lib\site-packages\pip\index.py", line 545, in _get_pages
page = self._get_page(location)
File "c:\python27\lib\site-packages\pip\index.py", line 648, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "c:\python27\lib\site-packages\pip\index.py", line 757, in get_page
"Cache-Control": "max-age=600",
File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py",
line 487, in get
return self.request('GET', url, **kwargs)
File "c:\python27\lib\site-packages\pip\download.py", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py",
line 475, in request
resp = self.send(prep, **send_kwargs)
File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py",
line 617, in send
r.content
File "c:\python27\lib\site-packages\pip\_vendor\requests\models.py", line
741, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or
bytes()
File "c:\python27\lib\site-packages\pip\_vendor\requests\models.py", line
664, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "c:\python27\lib\site-
packages\pip\_vendor\requests\packages\urllib3\response.py", line 353, in
stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:\python27\lib\site-
packages\pip\_vendor\requests\packages\urllib3\response.py", line 310, in
read
data = self._fp.read(amt)
File "c:\python27\lib\site-
packages\pip\_vendor\cachecontrol\filewrapper.py", line 54, in read
self.__callback(self.__buf.getvalue())
File "c:\python27\lib\site-
packages\pip\_vendor\cachecontrol\controller.py", line 297, in
cache_response
self.serializer.dumps(request, response, body=body),
File "c:\python27\lib\site-packages\pip\download.py", line 281, in set
return super(SafeFileCache, self).set(*args, **kwargs)
File "c:\python27\lib\site-
packages\pip\_vendor\cachecontrol\caches\file_cache.py", line 99, in set
with self.lock_class(name) as lock:
File "c:\python27\lib\site-
packages\pip\_vendor\lockfile\mkdirlockfile.py", line 19, in __init__
LockBase.__init__(self, path, threaded, timeout)
File "c:\python27\lib\site-packages\pip\_vendor\lockfile\__init__.py",
line 242, in __init__
hash(self.path)))
File "c:\python27\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xee in position 0:
ordinal not in range(128)
How can i solve this problem?
The answer above mine (the answer of Gal Avineri) was almost correct.
You should go to the ntpath file and change the line.
result_path = result_path + p_path
to the line,
result_path = result_path + p_path.decode('latin1')
I found the problem.
I saw that the last error came from ntpath, trying to decode a byte using ascii.
That meant that either result_path or p_path were string that were'nt encoded in ascii.
when i printed their types, it showed that result_path was unicode and p_path was a string. when i printed p_path, i recognized it was encoded in latin1.
So i replaced the line:
result_path = result_path + p_path
to the line:
result_path = result_path + decode(p_path,'latin1')
and that solved it :D
Above answers gave me the right clue but neither solution worked for me. Turns out I had the issue due to an 'å' in my username in windows.
I solved it by changing the line to:
result_path = result_path + p_path.encode('utf-8')