Pip: 'utf8' encoding not found

Created on 3 Nov 2016  路  15Comments  路  Source: pypa/pip

  • Pip version: 9.0.0
  • Python version: 2.7.12
  • Operating System: Ubuntu 16.04.1 LTS xenial

Description:

I tried to run Django makemessages with the latest version of pip and it gives me the following error
./lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.py:1: Unknown encoding "utf8". Proceeding with ASCII instead.

xgettext: ./lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.py:1: Unknown encoding "utf8". Proceeding with ASCII instead.
xgettext: Non-ASCII string at ./lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.py:64.
          Please specify the source encoding through --from-code or through a comment
          as specified in http://www.python.org/peps/pep-0263.html.
auto-locked

Most helpful comment

What worked for me was using the -i flag to ignore my virtualenv:

python manage.py makemessages -l 'sv' -i venv

All 15 comments

Thanks, I opened an issue in there.
https://github.com/gsnedders/python-webencodings/issues/8

It seems like the problem is that xgettext does not assume utf8 is an alias for utf-8.

@AurangZ, have you tried doing what the error message suggests? Specifically, passing xgettext a --from-code=UTF-8 flag.

@di Thanks for your response.
xgettext is getting called inside django's manage.py makemessages command. I don't see how I can pass parameters to xgettext.

@AurangZ It seems like https://pypi.python.org/pypi/django-makemessages-xgettext might help you.

Thanks @di. I'll see how I can use the new makemessage package.

I don't have this issue with pip 8.1.2. Is there something changed related to xgettext?

@AurangZ The reason is because pip did not vendor python-webencodings before 9.0.0.

I see. Thanks @di.

I guess the ultimate fix is to fix this in webencoding and import the fix into the pip. Should we close this ticket? or keep it open until the new changes from webencoding is merged? I'll let you decide.

If django-makemessage-xgettext was successful I report back here on this ticket.
Because I am very close to a deadline, for now I am going to keep using 8.1.2 though.

@AurangZ Sorry for the late reply. I made https://github.com/gsnedders/python-webencodings/pull/9 to fix this in python-webencodings, let's leave this issue open until that PR is merged, released, and vendored into pip.

Thanks @di

This appears to have been merged, and is now just waiting on a release.

I've encountered the same problem some minutes ago. Is it really OK? :-"
I'm using pip 9.0.1, Django 2.0.2, Python 3.6 on Ubuntu 17.10

Same issue
Django 1.9.6
pip 9.0.3
Python 2.7.10
macOS 10.13.4 (17E199)

What worked for me was using the -i flag to ignore my virtualenv:

python manage.py makemessages -l 'sv' -i venv

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings