Issue2301

classification
Title: ensurepip doesn't work on Japanese Mac
Type: Severity: normal
Components: Library Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: methane, zyasoft
Priority: urgent Keywords:

Created on 2015-03-29.04:28:01 by methane, last changed 2015-04-10.01:55:17 by zyasoft.

Messages
msg9723 (view) Author: INADA Naoki (methane) Date: 2015-03-29.04:28:00
$ ~/local/jython2.7rc1/bin/jython -m ensurepip
Ignoring indexes: https://pypi.python.org/simple/
Downloading/unpacking setuptools
Downloading/unpacking pip
Installing collected packages: setuptools, pip
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/basecommand.py", line 133, in main
    status = self.run(options, args)
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/commands/install.py", line 325, in run
    requirement_set.install(
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/commands/install.py", line 325, in run
    requirement_set.install(
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/req/req_set.py", line 633, in install
    requirement.install(
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/req/req_install.py", line 719, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/req/req_install.py", line 990, in move_wheel_files
    move_wheel_files(
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/wheel.py", line 201, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/wheel.py", line 185, in clobber
    assert not info_dir, 'Multiple .dist-info directories'
AssertionError: Multiple .dist-info directories

Traceback (most recent call last):
  File "/Users/inada-n/local/jython2.7rc1/Lib/runpy.py", line 161, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/inada-n/local/jython2.7rc1/Lib/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/inada-n/local/jython2.7rc1/Lib/ensurepip/__main__.py", line 4, in <module>
    ensurepip._main()
  File "/Users/inada-n/local/jython2.7rc1/Lib/ensurepip/__init__.py", line 220, in _main
    bootstrap(
  File "/Users/inada-n/local/jython2.7rc1/Lib/ensurepip/__init__.py", line 123, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/Users/inada-n/local/jython2.7rc1/Lib/ensurepip/__init__.py", line 46, in _run_pip
    pip.main(args)
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/__init__.py", line 184, in main
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/basecommand.py", line 170, in main
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/basecommand.py", line 170, in main
  File "/var/folders/11/3pzjxxcd7q53dbfsm95ms3d00000gn/T/tmp9iBexh/pip-1.6-py2.py3-none-any.whl/pip/basecommand.py", line 207, in open_logfile
UnicodeEncodeError: 'ascii' codec can't encode character u'\u65e5' in position 17: ordinal not in range(128)
msg9724 (view) Author: INADA Naoki (methane) Date: 2015-03-29.04:28:37
$ ~/local/jython2.7rc1/bin/jython
iJython 2.7rc1 (default:3d8067c56a1d, Mar 24 2015, 16:08:42)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_05
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.strftime('%c')
u'\u65e5 3 29 12:19:08 2015'
>>> print(time.strftime('%c'))
日 3 29 12:19:13 2015
msg9728 (view) Author: Jim Baker (zyasoft) Date: 2015-03-29.05:36:06
Try installing on a non Unicode path

Likely the same underlying bug as #2294
msg9729 (view) Author: INADA Naoki (methane) Date: 2015-03-29.05:52:05
This is not a problem of unicode path.
time.strftim('%c') produce unicode string.
jythontools/pip attempt to write it to logfile.

See here
https://github.com/jythontools/pip/blob/develop/pip/basecommand.py#L207
msg9730 (view) Author: INADA Naoki (methane) Date: 2015-03-29.05:56:09
FYI, CPython2's time.strftime('%c') produces byte string, not unicode.

>>> import time
>>> time.strftime('%c')
'Sun Mar 29 14:54:48 2015'
>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'ja_JP.UTF-8'
>>> time.strftime('%c')
'\xe6\x97\xa5  3/29 14:55:13 2015'
>>> print(_)
日  3/29 14:55:13 2015
msg9732 (view) Author: Jim Baker (zyasoft) Date: 2015-03-29.14:16:26
Naoki, thanks for the pointing out the problem with time.strftime and that causing the logging itself to fail, that's very helpful!

Are you able to use ensurepip then from the command line like so:

$ LC_ALL=C jython -m ensurepip
msg9733 (view) Author: INADA Naoki (methane) Date: 2015-03-29.14:57:41
LC_ALL=C doesn't affect on Mac.
After changing system language to English from system configuration, I can run ensurepip.
msg9749 (view) Author: Jim Baker (zyasoft) Date: 2015-04-02.03:00:55
Fixed as of https://hg.python.org/jython/rev/c06821df7422
msg9753 (view) Author: Jim Baker (zyasoft) Date: 2015-04-05.14:35:35
Naoki, Please try the first build of RC2 - http://sourceforge.net/p/jython/mailman/message/33715614/ - and see if this resolves the issue. Thanks!
msg9757 (view) Author: INADA Naoki (methane) Date: 2015-04-05.18:08:57
Success! Thank you.

---
$ ~/local/jython2.7rc2/bin/jython -m ensurepip
Ignoring indexes: https://pypi.python.org/simple/
Downloading/unpacking setuptools
Downloading/unpacking pip
Installing collected packages: setuptools, pip
Successfully installed setuptools pip
Cleaning up...

$ ~/local/jython2.7rc2/bin/pip -V
pip 1.6.dev1 from /Users/inada-n/local/jython2.7rc2/Lib/site-packages (python 2.7)
History
Date User Action Args
2015-04-10 01:55:17zyasoftsetstatus: pending -> closed
2015-04-05 18:08:57methanesetmessages: + msg9757
2015-04-05 14:35:36zyasoftsetmessages: + msg9753
2015-04-02 03:00:55zyasoftsetstatus: open -> pending
resolution: accepted -> fixed
messages: + msg9749
2015-03-30 20:08:06zyasoftsetpriority: urgent
assignee: zyasoft
resolution: accepted
2015-03-29 14:57:41methanesetmessages: + msg9733
2015-03-29 14:16:26zyasoftsetmessages: + msg9732
2015-03-29 05:56:09methanesetmessages: + msg9730
2015-03-29 05:52:05methanesetmessages: + msg9729
2015-03-29 05:36:06zyasoftsetnosy: + zyasoft
messages: + msg9728
2015-03-29 04:28:38methanesetmessages: + msg9724
2015-03-29 04:28:01methanecreate