Can't run pip: UnicodeDecodeError - python

I have trouble using pip. For example:
pip install numpy --upgrade
Gives me the following error:
Collecting numpy
Using cached numpy-1.10.2.tar.gz
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 305, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 705, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/dist-packages/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/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/req/req_set.py", line 505, in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 123, in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 376, in run_egg_info
self.setup_py, self.name,
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 347, in setup_py
import setuptools # noqa
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module>
from setuptools.extension import Extension
File "/usr/local/lib/python2.7/dist-packages/setuptools/extension.py", line 8, in <module>
from .dist import _get_unpatched
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 19, in <module>
import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3138, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3124, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3151, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 652, in _build_master
ws = cls()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 645, in __init__
self.add_entry(entry)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 701, in add_entry
for dist in find_distributions(entry, True):
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2139, in find_on_path
path_item, entry, metadata, precedence=DEVELOP_DIST
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2521, in from_location
py_version=py_version, platform=platform, **kw
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2835, in _reload_version
md_version = _version_from_file(self._get_metadata(self.PKG_INFO))
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2486, in _version_from_file
line = next(iter(version_lines), '')
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2654, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2030, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2025, in get_metadata
metadata = f.read()
File "/usr/lib/python2.7/codecs.py", line 296, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb6 in position 147: invalid start byte
Here are some clues:
(i) I have the same error when I try to run Spyder. It also appears when I try to to install other packages wtih pip, pandas for example.
(ii) I have the feeling, that this is related to the default encoding since sys.getdefaultencoding gives me 'ascii'
Note that it works well if I do it in a virtualenv.
I'm new to ubuntu so I might have done someting wrong.
Setup: python 2.7.6; pip 7.1.2; ubuntu 14.04.03.
Thank you for your help.

I had the same issue. In my case, it comes from a non-standard character in a module description.
I added a
print f.path
in the script
/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py
before line 2025, which allowed me to identify the file which was raising an error. It appeared to be the file
/usr/lib/pymodules/python2.7/rpl-1.5.5.egg-info
whose author has a name containing the ö character, which can not be read. I simply replaced the "Göran" with "Goran" in this file and it fixed the problem.
hope this helps.

Related

pip cannot install or upgrade, with UnicodeDecodeError reported

I am using anaconda Powershell Prompt in Win10. UnicodeDecodeError was reported when installing package with pip (version: 21.2.4). I found this error would reported with the kernel Python 3.6.7 and Python 3.9.7.Both the installation and the upgrade failed and reported the same error. I've tried the following command.
pip install simplejson
pip install simplejson --upgrade
The package can be anything and report the same bug.
Same error was reported using the Windows CMD. I tried the following command using Windows CMD.
py -m pip install simplejson
py -m pip install --upgrade pip
Here is the error report I got.
ERROR: Exception:
Traceback (most recent call last):
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 173, in _main
status = self.run(options, args)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\cli\req_command.py", line 203, in wrapper
return func(self, options, args)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 315, in run
requirement_set = resolver.resolve(
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 94, in resolve
result = self._result = resolver.resolve(
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 472, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 341, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
return bool(self._sequence)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 140, in __bool__
return any(self)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 128, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 29, in _iter_built
for version, func in infos:
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 272, in iter_index_candidate_infos
result = self._finder.find_best_candidate(
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\index\package_finder.py", line 851, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\index\package_finder.py", line 798, in find_all_candidates
page_candidates = list(page_candidates_it)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\index\sources.py", line 134, in page_candidates
yield from self._candidates_from_page(self._link)
File "E:\Program Files\Anaconda3\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 "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\index\collector.py", line 490, in fetch_page
return _get_html_page(location, session=self.session)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\index\collector.py", line 400, in _get_html_page
resp = _get_html_response(url, session=session)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\index\collector.py", line 115, in _get_html_response
resp = session.get(
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\network\session.py", line 454, in request
return super().request(method, url, *args, **kwargs)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line 528, in request
prep = self.prepare_request(req)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line 456, in prepare_request
p.prepare(
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\requests\models.py", line 320, in prepare
self.prepare_auth(auth, url)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\requests\models.py", line 556, in prepare_auth
r = auth(self)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\network\auth.py", line 208, in __call__
url, username, password = self._get_url_and_credentials(req.url)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\network\auth.py", line 180, in _get_url_and_credentials
username, password = self._get_new_credentials(original_url)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_internal\network\auth.py", line 145, in _get_new_credentials
netrc_auth = get_netrc_auth(original_url)
File "E:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\requests\utils.py", line 216, in get_netrc_auth
_netrc = netrc(netrc_path).authenticators(host)
File "E:\Program Files\Anaconda3\lib\netrc.py", line 30, in __init__
self._parse(file, fp, default_netrc)
File "E:\Program Files\Anaconda3\lib\netrc.py", line 39, in _parse
toplevel = tt = lexer.get_token()
File "E:\Program Files\Anaconda3\lib\shlex.py", line 109, in get_token
raw = self.read_token()
File "E:\Program Files\Anaconda3\lib\shlex.py", line 140, in read_token
nextchar = self.instream.read(1)
UnicodeDecodeError: 'gbk' codec can't decode byte 0xff in position 0: illegal multibyte sequence
I have reinstalled the pip, Anaconda, and the python interpreter. It still failed. I think it has nothing to do with the pip. Something went wrong with the input stream. The default decode format is "GBK". I tried to change decode format to "utf-8" with the following command. It failed again with the same error.
chcp 65001
Thanks the suggestion from #Mobfi, I tried other similar commands, which return the same error notification.
chcp 437
chcp 850
Thanks the suggestion from #BoarGules, I start python with utf-8 decoder and tried to install/upgrade package with pip.
py -X utf8
I started the python console in powershell.
import pip
pip.main(['install', 'simplejson'])
Besides the similar traceback, I got another new traceback:
*same as aforementioned traceback*
File "E:\Program Files\Anaconda3\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Anybody can help? Any potential solution, clues or similar experiences is welcomed.

When i run 'pip install scipy' on my Pycharm Terminal i get Attribute Error

i am trying to install scipy package on one of my Pycharm projects. i get the following Attribute Error,
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'text_temp'
following is the exception that i am getting,
Collecting scipy
Exception:
Traceback (most recent call last):
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/cli/base_command.py", line 179, in main
status = self.run(options, args)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/commands/install.py", line 315, in run
resolver.resolve(requirement_set)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/resolve.py", line 131, in resolve
self._resolve_one(requirement_set, req)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/resolve.py", line 294, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/resolve.py", line 242, in _get_abstract_dist_for
self.require_hashes
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/operations/prepare.py", line 269, in prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/req/req_install.py", line 196, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/index.py", line 639, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/index.py", line 614, in find_all_candidates
self._package_versions(page.iter_links(), search)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/index.py", line 775, in _package_versions
for link in self._sort_links(links):
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/index.py", line 759, in _sort_links
for link in links:
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_internal/index.py", line 971, in iter_links
namespaceHTMLElements=False,
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_vendor/html5lib/html5parser.py", line 47, in parse
return p.parse(doc, **kwargs)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_vendor/html5lib/html5parser.py", line 289, in parse
self._parse(stream, False, None, *args, **kwargs)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_vendor/html5lib/html5parser.py", line 134, in _parse
self.mainLoop()
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_vendor/html5lib/html5parser.py", line 239, in mainLoop
new_token = phase.processSpaceCharacters(new_token)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_vendor/html5lib/html5parser.py", line 469, in processSpaceCharacters
self.tree.insertText(token["data"])
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_vendor/html5lib/treebuilders/base.py", line 357, in insertText
parent.insertText(data)
File "/Users/rohitgite/PycharmProjects/HelloWorld/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/_vendor/html5lib/treebuilders/etree.py", line 109, in insertText
if not self._element.text_temp:
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'text_temp'

PIP fails installing pylint

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.

UnicodeDecodeError in pip install flake8 on Windows 8.1

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.)

Pylearn2 Tutorial Import Error

While running python make_dataset in the quick start example for Pylearn2, I've run across an import error in a Theano .so file. The heart of the issue seems to be this: undefined symbol: _gfortran_st_write. I'm running development versions of numpy, scipy, Theano, and Pylearn2. Any ideas?
Traceback (most recent call last):
File "make_dataset.py", line 58, in <module>
train.apply_preprocessor(preprocessor=pipeline, can_fit=True)
File "/home/mmay/Downloads/Installs/pylearn2/pylearn2/datasets/dense_design_matrix.py", line 710, in apply_preprocessor
preprocessor.apply(self, can_fit)
File "/home/mmay/Downloads/Installs/pylearn2/pylearn2/datasets/preprocessing.py", line 175, in apply
item.apply(dataset, can_fit)
File "/home/mmay/Downloads/Installs/pylearn2/pylearn2/datasets/preprocessing.py", line 1424, in apply
new_x_symbol)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/compile/function.py", line 223, in function
profile=profile)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/compile/pfunc.py", line 511, in pfunc
on_unused_input=on_unused_input)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/compile/function_module.py", line 1332, in orig_function
defaults)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/compile/function_module.py", line 1198, in create
_fn, _i, _o = self.linker.make_thunk(input_storage=input_storage_lists)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/gof/link.py", line 489, in make_thunk
output_storage=output_storage)[:3]
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/gof/vm.py", line 881, in make_all
no_recycling))
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/gof/op.py", line 618, in make_thunk
output_storage=node_output_storage)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/gof/cc.py", line 987, in make_thunk
keep_lock=keep_lock)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/gof/cc.py", line 930, in __compile__
keep_lock=keep_lock)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/gof/cc.py", line 1367, in cthunk_factory
key=key, fn=self.compile_cmodule_by_step, keep_lock=keep_lock)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/gof/cmodule.py", line 1005, in module_from_key
module = next(compile_steps)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/gof/cc.py", line 1282, in compile_cmodule_by_step
preargs=preargs)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/gof/cmodule.py", line 1993, in compile_str
return dlimport(lib_filename)
File "/usr/local/lib/python2.7/dist-packages/Theano-0.6.0-py2.7.egg/theano/gof/cmodule.py", line 290, in dlimport
rval = __import__(module_name, {}, {}, [module_name])
ImportError: ('The following error happened while compiling the node', Dot22(Elemwise{sub,no_inplace}.0, P_), '\n', '/home/mmay/.theano/compiledir_Linux-3.2.0-63-generic-x86_64-with-elementary_OS-0.2-luna-x86_64-2.7.3-64/tmpFGIAyD/0e96d34cc789a5edba0ae9e735b21a70.so:
undefined symbol: _gfortran_st_write', '[Dot22(<TensorType(float32, matrix)>, P_)]')
The problem was resolved after removing ATLAS, installing OpenBLAS, reinstalling numpy + scipy + theano, and then installing Pylearn2 from source.
See https://github.com/Theano/Theano/blob/master/doc/install_ubuntu.txt#L70 of the Theano install guide for a more detailed explanation.

Categories

Resources