Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PIP Install Numpy throws an error "ascii codec can't decode byte 0xe2"

I have a freshly installed Ubuntu on a freshly built computer. I just installed python-pip using apt-get. Now when I try to pip install Numpy and Pandas, it gives the following error.

I've seen this error mentioned in quite a few places on SO and Google, but I haven't been able to find a solution. Some people mention it's a bug, some threads are just dead... What's going on?

Traceback (most recent call last):   File "/usr/bin/pip", line 9, in <module>     load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()   File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 185, in main     return command.main(cmd_args)   File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main     text = '\n'.join(complete_log) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 72: ordinal not in range(128) 
like image 410
Josh.F Avatar asked Oct 20 '14 19:10

Josh.F


2 Answers

I had this exact problem recently and used

apt-get install python-numpy 

This adds numpy to your system python interpreter. I may have had to do the same for matplotlib. To use in a virtualenv, you have to create your environment using the

--system-site-packages 

option

http://www.scipy.org/install.html

like image 101
Jeff M. Avatar answered Sep 19 '22 03:09

Jeff M.


For me @Charles Duffy comment solved it. Put this in your env:

LC_ALL=C

You can add it to your .bashrc with a line like this:

export LC_ALL=C

But take in care that you'll affect all other programs. So you may want to use it just for the pip run:

$ LC_ALL=C pip install ...

like image 35
msemelman Avatar answered Sep 21 '22 03:09

msemelman