Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#28630 closed Bug (invalid)

Can't install django dev version when path contains non-ascii characters on Windows10

Reported by: zhaogp Owned by: nobody
Component: Internationalization Version: dev
Severity: Normal Keywords: install, unicode, encode, chinese characters
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

My home directory like this "C:\Users\张三" where "张三" is my chinese name.

UnicodeEncodeError was raised when i install django using "pip install -e ."

<UnicodeEncodeError: 'ascii' codec can't encode characters in position 11-13: ordinal not in range(128) ">

However I install it on linux where my home dir is "/home/zhangsan", it can be installed sucessfully.

I know that the error above is caused by the chinese-characters in my home directory.

Can this be fixed? Thanks.

Attachments (1)

ticket_28630.txt (3.5 KB ) - added by zhaogp 7 years ago.
full traceback

Download all attachments as: .zip

Change History (6)

comment:1 by Claude Paroz, 7 years ago

Without the full traceback, it's impossible to say if Django is at fault. Could you give us that information?

in reply to:  1 comment:2 by zhaogp, 7 years ago

Replying to Claude Paroz:

Without the full traceback, it's impossible to say if Django is at fault. Could you give us that information?

Hi Claude, here the full traceback is, thanks!

C:\Users\赵国平\django>pip install -e .
Obtaining file:///C:/Users/%E8%B5%B5%E5%9B%BD%E5%B9%B3/django
Requirement already satisfied: pytz in c:\python34\lib\site-packages (from Django==2.1.dev20170924155150)
Installing collected packages: Django
  Found existing installation: Django 2.1.dev20170924155150
    Uninstalling Django-2.1.dev20170924155150:
      Successfully uninstalled Django-2.1.dev20170924155150
  Running setup.py develop for Django
    Complete output from command c:\python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\赵国平\\django\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace
('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps:
    running develop
    running egg_info
    writing dependency_links to Django.egg-info\dependency_links.txt
    writing requirements to Django.egg-info\requires.txt
    writing entry points to Django.egg-info\entry_points.txt
    writing Django.egg-info\PKG-INFO
    writing top-level names to Django.egg-info\top_level.txt
    reading manifest file 'Django.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    writing manifest file 'Django.egg-info\SOURCES.txt'
    running build_ext
    Creating c:\python34\lib\site-packages\Django.egg-link (link to .)
    Django 2.1.dev20170924155150 is already the active version in easy-install.pth
    Installing django-admin-script.py script to c:\python34\Scripts
    Installing django-admin.exe script to c:\python34\Scripts
	Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\赵国平\django\setup.py", line 72, in <module>
      'Topic :: Software Development :: Libraries :: Python Modules',
    File "c:\python34\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "c:\python34\lib\distutils\dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "c:\python34\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "c:\python34\lib\site-packages\setuptools\command\develop.py", line 36, in run
      self.install_for_development()
    File "c:\python34\lib\site-packages\setuptools\command\develop.py", line 150, in install_for_development
      self.process_distribution(None, self.dist, not self.no_deps)
    File "c:\python34\lib\site-packages\setuptools\command\easy_install.py", line 727, in process_distribution
      self.install_egg_scripts(dist)
    File "c:\python34\lib\site-packages\setuptools\command\develop.py", line 186, in install_egg_scripts
      self.install_script(dist, script_name, script_text, script_path)
    File "c:\python34\lib\site-packages\setuptools\command\easy_install.py", line 806, in install_script
      self.write_script(script_name, _to_ascii(script_text), 'b')
    File "c:\python34\lib\site-packages\setuptools\command\easy_install.py", line 107, in _to_ascii
      return s.encode('ascii')
  UnicodeEncodeError: 'ascii' codec can't encode characters in position 241-243: ordinal not in range(128)

  ----------------------------------------
Rolling back uninstall of Django
mmand "c:\python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\赵国平\\django\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close()
xec(compile(code, __file__, 'exec'))" develop --no-deps" failed with error code 1 in C:\Users\赵国平\django\
Last edited 7 years ago by Tim Graham (previous) (diff)

by zhaogp, 7 years ago

Attachment: ticket_28630.txt added

full traceback

comment:3 by Claude Paroz, 7 years ago

Summary: Cann't install django when there are chinese-characters in my home directory name on Windows10Can't install django dev version when path contains non-ascii characters on Windows10

I guess that at some point the path is added to the django-admin.exe generated script and as setuptools is not able to handle non-ascii content in scripts [1], it fails.
Someone more familiar with Windows may help here. Not sure if Django can do something to prevent that.

[1] https://github.com/pypa/setuptools/issues/761

comment:4 by Tim Graham, 7 years ago

Resolution: invalid
Status: newclosed

I think this needs to be fixed in setuptools.

in reply to:  4 comment:5 by zhaogp, 7 years ago

I resolved it by setting the environment variable "LC_ALL" to "en_US.UTF-8"
Replying to Tim Graham:

I think this needs to be fixed in setuptools.

Note: See TracTickets for help on using tickets.
Back to Top