You are not logged in.

#1 2016-04-26 03:39:18

s4n7h0
New Member
Registered: 2016-04-26
Posts: 1

Hydrogen RC2 pip error : UnicodeDecodeError: 'utf8' codec can't decode

Hi All,

  Anyone facing similar issues with pip installation in Hydrogen RC2. I'm getting following error. Any suggestion to resolve this issue ?


~$ pip --version
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==8.1.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/__init__.py", line 14, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/utils/__init__.py", line 27, in <module>
    from pip._vendor import pkg_resources
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 3130, in <module>
    @_call_aside
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 3116, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 3143, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 633, in _build_master
    ws = cls()
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 626, in __init__
    self.add_entry(entry)
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 682, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 2120, in find_on_path
    path_item, entry, metadata, precedence=DEVELOP_DIST
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 2510, in from_location
    py_version=py_version, platform=platform, **kw
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 2827, in _reload_version
    md_version = _version_from_file(self._get_metadata(self.PKG_INFO))
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 2475, in _version_from_file
    line = next(iter(version_lines), '')
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 2643, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 2011, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/pkg_resources/__init__.py", line 2006, 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

Offline

#2 2016-04-26 04:08:22

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,040
Website

Re: Hydrogen RC2 pip error : UnicodeDecodeError: 'utf8' codec can't decode

It's got nothing to do with BL or Debian but rather the latest pip release. From the changelog for pip 8.1.1:

8.1.1 (2016-03-17)
    Fix regression with non-ascii requirement files on Python 2 and add support for encoding headers in requirement files (#3548, PR #3547).

I suggest to try using an older version of pip until they have ironed out their bugs (or just use Python3). Google for the first lines of the traceback; there will be numerous results.

Offline

#3 2016-05-05 13:49:31

aanastasiou
Member
Registered: 2016-05-05
Posts: 14

Re: Hydrogen RC2 pip error : UnicodeDecodeError: 'utf8' codec can't decode

Hello

I am facing the same issue and having tried a number of alternative solutions I thought I would reach out to the forum.

First of all, a Bunsen installation does not include pip by default. Since trying to install pip using the "get_pip.py" script, as per the pip documentation, was failing with the above error, I proceeded to install python-pip from the Debian repo.

This brings 129MB of additional software (which I don't mind) and pip 1.5.6. With pip 1.5.6 in place now, I tried to upgrade pip itself which fails again with the above message.

BUT! What also fails now are subsequent packages. For example:

>> sudo pip install ipython

UnicodeDecodeError: 'utf8' codec can't decode....etc when attempting to install the pexpect dependency.

This is not good sad I mean, this is not good in general when there is a gazilion of Python packages to install and a few other customisations to be applied.

Any further ideas on what I could do about this?

Offline

#4 2016-05-05 14:12:17

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,040
Website

Re: Hydrogen RC2 pip error : UnicodeDecodeError: 'utf8' codec can't decode

If you install pip from the repos, it can't be upgraded because it's part of the package system.

pip is a bloody mess. I suggest you use python3.

Anyway, can you remove every trace of pip (including whatever that get_pip script did) and start clean with the repo pip?

We also had this https://forums.bunsenlabs.org/viewtopic.php?id=933 but that seems kind of unrelated.

Make sure you only install stuff with pip to /usr/local.

Offline

#5 2016-05-06 08:55:14

aanastasiou
Member
Registered: 2016-05-05
Posts: 14

Re: Hydrogen RC2 pip error : UnicodeDecodeError: 'utf8' codec can't decode

If you install pip from the repos, it can't be upgraded because it's part of the package system.

It could be upgraded on crunchbang and it can on Ubuntu too by the way smile

pip is a bloody mess. I suggest you use python3

I agree but this is not possible for all of the Python packages I will need.

Anyway, can you remove every trace of pip (including whatever that get_pip script did) and start clean with the repo pip?

I did and it seemed to work but trying to install ipython, the problem surfaced again when trying to install the dependency of pexpect hmm

Yep, that virtualenv problem is a bit unrelated because I am trying to update the system's packages.

How do I make sure that pip installs stuff in /usr/local? (By default it should, no?)

Offline

#6 2016-05-06 12:57:46

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,040
Website

Re: Hydrogen RC2 pip error : UnicodeDecodeError: 'utf8' codec can't decode

aanastasiou wrote:

If you install pip from the repos, it can't be upgraded because it's part of the package system.

It could be upgraded on crunchbang and it can on Ubuntu too by the way smile

Well, overwriting files owned by a system package is not a swell idea.

How do I make sure that pip installs stuff in /usr/local? (By default it should, no?)

I remember that differently; with things landing in /usr/lib. But here's how to configure that behaviour if it's not the default. This is cleaner and you can just nuke /usr/local/$PYTHONYAYAYAD without deleting system stuff.

Offline

#7 2018-02-02 06:21:10

ATG-Fox
Member
From: Fareham - UK
Registered: 2018-01-31
Posts: 8
Website

Re: Hydrogen RC2 pip error : UnicodeDecodeError: 'utf8' codec can't decode

I know this is old but I ran into the same problem and I'm sure there will be other people that do too.

Searching online brings up lots of fancy ways to try to resolve this but none worked and some created new problems.

After working through the night I managed to find out what the cause was;

Chris Warrick wrote:

That’s a warning, and it happens to be caused by the `rpl` apt
package. Remove it from your system and try `pip --version` again:
https://github.com/certbot/certbot/issues/3795

# apt-get remove rpl

Now pip is working fine again.

Source; https://code.activestate.com/lists/python-list/719880/

Last edited by ATG-Fox (2018-02-02 06:28:27)

Offline

Board footer

Powered by FluxBB