11
I use Mac OS and use HomeBrew
as a package manager.
I installed the python 2.7.10
. Together with this installation was to have occurred the pip
. However the following problem occurs:
==> /usr/local/Cellar/python/2.7.10/bin/python -s setup.py --no-user-cfg install --force
File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child raise child_exception
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128)
It seems that the problem is with the encoding. I made an attempt to edit the file subprocess.py
putting # -*- coding: utf-8 -*-
, but to no avail.
I also realized that the problem is not with the manager brew
, because the same happened with the easy_install
:
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
raise child_exception
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128)
I wanted to use the /usr/local/lib/python2.7/site-package/
as directory for the python2.7 packages
Possible duplicate of: "Unicodedecodeerror - unicodedecodeerror 'ascii' codec can’t Decode byte 0xc3"
– mgibsonbr
How to resolve this @mgibsonbr? Got some idea?
– Alã Damasceno
Unfortunately, no. I’ve seen the previous question, but since I have no experience with Mac OS or Homebrew, I have no idea what it might be. I’ve never had this problem on Windows or Linux (the ones I’ve used
pip
).– mgibsonbr
This problem did not occur, but when I uninstalled Pip, because I believed I had problems with it, I could no longer install.
– Alã Damasceno
This error occurs when you try to install Python himself, or is it when installing a particular library or package? From what I’ve been reading around, this error is common when trying to encode or decode a string twice (i.e. from string to byte and again to byte, or from byte to string and again to string). It may be due to a programming error, but I can’t imagine it happening within Python itself... Maybe there was some mix of Python 2 and 3 code, I don’t know...
– mgibsonbr
The error occurs in python installation via:
brew install python
and through theeasy_install pip
@mgibsonbr.– Alã Damasceno
Yeah, I think only someone with Python experience on the Mac can help you, I’m totally in the dark... :(
– mgibsonbr
I do not believe that there was a mixture of code. The
pip3
works very well. It has been installing along with thepython3
through Brew. However, as you well know, there are projects that only run on python 2x– Alã Damasceno
There were 3 attempts: 1- using the
brew
during the installation of thepython
. 2- using theeasy_install
, system native. 3- downloading the Pip project from github running thepython setup.py install
. The problem is always the same, accusing in separate directories. In the first and third points to the/usr/local/...
and in the second to/System/Libary/...
– Alã Damasceno
problems seem to be associated with
subprocess.py
– Alã Damasceno
The
raise child_exception
gives me the impression that subprocess.py is only relaunching an exception that was generated elsewhere. This would indicate that the fault does not need to be exactly subprocess.py (and the encoding of that file). You can try for some prints in this region of the code to see what is happening. Another possibility is to use thestrace
(if you have it on OSX) to find out which files subprocess.py was trying to read before its error occurred.– hugomg