Skip to content

Cannot install package with files that have non-ascii filenames #1698

Closed
@megies

Description

@megies

For me installation of a python package fails because some test files in it have non-ascii characters in filenames:

$ pip install https://github.com/megies/seishub.core/archive/quakeml.zip
Downloading/unpacking https://github.com/megies/seishub.core/archive/quakeml.zip
  Downloading quakeml.zip (unknown size): 3.5MB downloaded
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/home/megies/python_seishub/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/home/megies/python_seishub/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/home/megies/python_seishub/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/req.py", line 1197, in prepare_files
    do_download,
  File "/home/megies/python_seishub/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/req.py", line 1375, in unpack_url
    self.session,
  File "/home/megies/python_seishub/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/download.py", line 582, in unpack_http_url
    unpack_file(temp_location, location, content_type, link)
  File "/home/megies/python_seishub/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/util.py", line 621, in unpack_file
    unzip_file(filename, location, flatten=not filename.endswith(('.pybundle', '.whl')))
  File "/home/megies/python_seishub/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/util.py", line 492, in unzip_file
    leading = has_leading_dir(zip.namelist()) and flatten
  File "/home/megies/python_seishub/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/util.py", line 232, in has_leading_dir
    prefix, rest = split_leading_dir(path)
  File "/home/megies/python_seishub/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/util.py", line 216, in split_leading_dir
    path = str(path)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 85-87: ordinal not in range(128)

Storing debug log for failure in /home/megies/.pip/pip.log

The problematic files are some test files in there:
https://github.com/megies/seishub.core/tree/quakeml/seishub/core/processor/tests/data/filesystem/special

I'm using pip 1.5.4 on Python 2.7.6.

Installation seems to run smoothly when commenting out this line: https://github.com/pypa/pip/blob/develop/pip/util.py#L228

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-lockedOutdated issues that have been locked by automation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions