5

When I tried to install Pillow using pip-3.3, I got an error instead, see the traceback below.

  File "/home/samsun/workspace/python/chat_environment/lib/python3.3/site-packages/pip/req.py", line 297, in egg_info_data
    data = fp.read()
  File "/home/samsun/workspace/python/chat_environment/lib/python3.3/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 14439: ordinal not in range(128)

I think the traceback is telling me some characters in the file are Unicode, but Python is using ASCII to read the file.

I want to change python3.3 filesystemencoding to resolve this error; is there a way to change the default filesystemencoding?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Captain Kidd
  • 1,253
  • 2
  • 13
  • 20
  • What makes you think that changing the default filesystem encoding would fix your problem? Usually the default is **not** ASCII anyway. What command did you give, and what is the full traceback? – Martijn Pieters Jan 08 '14 at 12:34
  • I changed my question.Pls help me to solve this problem. Thanks a lot – Captain Kidd Jan 08 '14 at 12:58
  • What exactly did you do? What is the command line, and are you using a requirements.txt file? – Martijn Pieters Jan 08 '14 at 13:00
  • I just want to install Pillow using Pip-3.3. The command line is very simple -- sudo pip-3.3 install Pillow. And I didn't use any requirements.txt – Captain Kidd Jan 08 '14 at 13:07
  • This may be a bug in the Pillow metadata; changing the default filesystem encoding is hardly the way to fix this. – Martijn Pieters Jan 08 '14 at 13:13
  • My environment variable LANG is "en_US:zh_CN.UTF-8". How can I change the filesystem encoding – Captain Kidd Jan 08 '14 at 13:17
  • Is there another way to get around this bug? – Captain Kidd Jan 08 '14 at 13:20
  • I don't know, but I alerted the Pillow maintainers to take a look. No promises here, but installation should Just Work on all systems (if the dependencies are met). – Martijn Pieters Jan 08 '14 at 13:26
  • 2
    More likely a broken Python installation than a Pillow issue, as this is the first I've heard of it. If you still suspect Pillow, please open a ticket here: https://github.com/python-imaging/Pillow/issues – aclark Jan 08 '14 at 18:28
  • got same problem on windows with "pip install Pillow" – apelliciari Jan 18 '14 at 14:33
  • @apelliciari See my answer below. Upgrading pip will likely fix your problem. –  Jan 20 '14 at 13:39
  • I already have pip 1.5. I solved it using easy_install instead `easy_install Pillow` – apelliciari Jan 20 '14 at 13:41
  • @apelliciari You may want to [let the pip people know](https://github.com/pypa/pip/issues) then: it pip can't install it, but easy_install can, that might (still) be a bug with pip. –  Jan 21 '14 at 09:07

1 Answers1

7

I just ran into this issue as well. I'm not sure if it's a pip problem or a Pillow problem, but the "culprit" appears to be the name of one of the Pillow authors, which contains non-ascii characters (Håkan Karlsson). Apparently, an EGG info file is constructed from the CHANGES.rst file in Pillow, and pip tries to parse that in ascii, failing that. Changing the authors name seems like a bad idea, so pip should handle that better.

And indeed, pip install --upgrade pip worked for me (upgrading from pip 1.4 to 1.5). It seems this change fixed that.