1

I'm struggling with installing Theano 0.8.0 for python 2.7.11 (Anaconda 4.1.0 32-bit) in Windows 7. I have seen many similar questions here, but the related discussions were not really helpful for me. So let me ask a question myself.

I call the command

pip install Theano==0.8.0

(I tried both cmd and Anaconda prompt), and as a result I get Unicode decode error. The full log is (sorry, it's pretty long):

C:\Users\Andrey>pip install Theano==0.8.0
Collecting Theano==0.8.0

Exception:

Traceback (most recent call last):
  File
"C:\Anaconda2\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Anaconda2\lib\site-packages\pip\commands\install.py", line 310, in run
    wb.build(autobuilding=True)
  File "C:\Anaconda2\lib\site-packages\pip\wheel.py", line 750, in build
    self.requirement_set.prepare_files(self.finder)
  File "C:\Anaconda2\lib\site-packages\pip\req\req_set.py", line 370, in prepare_files
    ignore_dependencies=self.ignore_dependencies)) 
  File "C:\Anaconda2\lib\site-packages\pip\req\req_set.py", line 522, in _prepare_file
    finder, self.upgrade, require_hashes)
  File "C:\Anaconda2\lib\site-packages\pip\req\req_install.py", line 268, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "C:\Anaconda2\lib\site-packages\pip\index.py", line 442, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "C:\Anaconda2\lib\site-packages\pip\index.py", line 400, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "C:\Anaconda2\lib\site-packages\pip\index.py", line 545, in _get_pages
    page = self._get_page(location)
  File "C:\Anaconda2\lib\site-packages\pip\index.py", line 648, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "C:\Anaconda2\lib\site-packages\pip\index.py", line 757, in get_page
    "Cache-Control": "max-age=600",
  File "C:\Anaconda2\lib\site-packages\pip\_vendor\requests\sessions.py", line 487, in get
    return self.request('GET', url, **kwargs)
  File "C:\Anaconda2\lib\site-packages\pip\download.py", line 378, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)  
  File "C:\Anaconda2\lib\site-packages\pip\_vendor\requests\sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Anaconda2\lib\site-packages\pip\_vendor\requests\sessions.py", line 617, in send
    r.content
  File "C:\Anaconda2\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:\Anaconda2\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:\Anaconda2\lib\site-packages\pip\_vendor\requests\packages\urllib3\res ponse.py", line 353, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "C:\Anaconda2\lib\site-packages\pip\_vendor\requests\packages\urllib3\res ponse.py", line 310, in read
    data = self._fp.read(amt)
  File "C:\Anaconda2\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 54, in read  self.__callback(self.__buf.getvalue())
  File "C:\Anaconda2\lib\site-packages\pip\_vendor\cachecontrol\controller.py", line 297, in cache_response
    self.serializer.dumps(request, response, body=body),
  File "C:\Anaconda2\lib\site-packages\pip\download.py", line 281, in set
    return super(SafeFileCache, self).set(*args, **kwargs)
  File "C:\Anaconda2\lib\site-packages\pip\_vendor\cachecontrol\caches\file_cache.py", line 99, in set
    with self.lock_class(name) as lock:
  File "C:\Anaconda2\lib\site-packages\pip\_vendor\lockfile\mkdirlockfile.py", line 19, in __init__
    LockBase.__init__(self, path, threaded, timeout) 
 File "C:\Anaconda2\lib\site-packages\pip\_vendor\lockfile\__init__.py", line 242, in __init__
    hash(self.path)))
  File "C:\Anaconda2\lib\ntpath.py", line 85, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc0 in position 0: ordinal not in range(128)

Could you please give me an advise on how to proceed in such a case? I am a physicist, not an IT-expert, and I am really perplexed.

kirbyfan64sos
  • 10,377
  • 6
  • 54
  • 75
user10998
  • 31
  • 1
  • What happens if you run `set PYTHONIOENCODING=utf8` and `chcp 65001` first? – kirbyfan64sos Apr 04 '17 at 21:59
  • This gives a more complete description of what @refi64 is getting at http://stackoverflow.com/questions/10561923/unicodedecodeerror-ascii-codec-cant-decode-byte-0xef-in-position-1. – Max Shenfield Apr 04 '17 at 22:03
  • @refi64 , then it says "LookupError: unknown encoding: cp65001". I can show the full log, if necessary (now it is much shorter) – user10998 Apr 05 '17 at 07:56
  • @MaxShenfield, thanks for the reference. Would you mind if I ask a really noob question? How shall I type this in terminal: > $ echo $LANG > en_GB.UTF-8 Is it one line or two? Neither LANG nor en_GB.UTF-8 are executable commands... – user10998 Apr 05 '17 at 11:38
  • @user10998 Hmm...what do you get if you run `python -c "import socket; print socket.gethostname().decode('ascii', 'replace')"`? I have a hunch that your hostname contains a Unicode character, which is screwing up pip's cache. – kirbyfan64sos Apr 05 '17 at 16:56
  • @user10998 Also, I *think* a fix might be to run `python -c "import pip, sys; sys.setdefaultencoding('utf-8'); pip.main(sys.argv[1:])" Theano==0.8.0` instead. – kirbyfan64sos Apr 05 '17 at 16:58
  • @refi64, when I run the first command, I get 'Traceback (most recent call last): File "", line 1, in File "C:\Anaconda2\lib\encodings\cp866.py", line 12, in encode return codecs.charmap_encode(input,errors,encoding_map) UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-5: character maps to ' – user10998 Apr 06 '17 at 21:36
  • @refi64 And the second command gives me Attribute error: 'module' object has no attribute 'setdefaultencoding' – user10998 Apr 06 '17 at 21:39
  • @refi64 , and what is hostname? I have two Windows users, one with cyrillic name, and another one with latin (Andrey). Both have admin rights, and I run all this stuff when I'm logged as the "latin" user. By the way, - I have no problem with installing Theano 0.9 in Anaconda 3 (Python 3.5). But all other combinations (Theano 0.8 - Anaconda 2 & 3, and Theano 0.9 - Anaconda 2) lead to this issue. – user10998 Apr 06 '17 at 21:44

0 Answers0