Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#24761 closed Cleanup/optimization (worksforme)

Cannot `pip install` the zip of master

Reported by: Keryn Knight Owned by: nobody
Component: Packaging Version: dev
Severity: Normal Keywords:
Cc: django@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm pretty certain I used to be able to do this, though I'm not sure how long ago it was:

pip install https://github.com/django/django/archive/master.zip

which is ostensibly the quickest way to get a copy of master (currently targetting 1.9.x) without doing a git clone, which takes a bunch of time. It's also the easiest way of setting up continuous integration against master (eg: I think one of the ways in which I previously used this was to have travis-ci build using it to check for upcoming failues)

This no longer works, giving the following traceback:

Exception:
  Traceback (most recent call last):
    File "lib/python2.7/site-packages/pip/basecommand.py", line 246, in main
      status = self.run(options, args)
    File "lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
      requirement_set.prepare_files(finder)
    File "lib/python2.7/site-packages/pip/req/req_set.py", line 345, in prepare_files
      functools.partial(self._prepare_file, finder))
    File "lib/python2.7/site-packages/pip/req/req_set.py", line 290, in _walk_req_to_install
      more_reqs = handler(req_to_install)
    File "lib/python2.7/site-packages/pip/req/req_set.py", line 487, in _prepare_file
      download_dir, do_download, session=self.session,
    File "lib/python2.7/site-packages/pip/download.py", line 827, in unpack_url
      session,
    File "lib/python2.7/site-packages/pip/download.py", line 677, in unpack_http_url
      unpack_file(from_path, location, content_type, link)
    File "lib/python2.7/site-packages/pip/utils/__init__.py", line 630, in unpack_file
      flatten=not filename.endswith('.whl')
    File "lib/python2.7/site-packages/pip/utils/__init__.py", line 510, in unzip_file
      leading = has_leading_dir(zip.namelist()) and flatten
    File "lib/python2.7/site-packages/pip/utils/__init__.py", line 224, in has_leading_dir
      prefix, rest = split_leading_dir(path)
    File "lib/python2.7/site-packages/pip/utils/__init__.py", line 208, in split_leading_dir
      path = str(path)
  UnicodeEncodeError: 'ascii' codec can't encode character u'\u2297' in position 60: ordinal not in range(128)

the path at the point of error is:

path = u'django-master/tests/staticfiles_tests/apps/test/static/test/\u2297.txt'

I raised a bug against pip itself assuming that the lack of unicode handling was a problem in pip, but a response suggests that there is no safe fix for their end (because of how zip works?) and that Django ought to create & destroy such test files as part of the test case, rather than statically embedded on a known path, which seems sensible enough, if it's feasible in the test cases which touch such files.

Change History (3)

comment:1 by Jannis Leidel, 9 years ago

Resolution: worksforme
Status: newclosed

You can use the gzip'ed tarball that doesn't have the underlying problem while it's being fixed in pip:

pip install https://github.com/django/django/archive/master.tar.gz

comment:2 by Keryn Knight, 9 years ago

Based on the response on pip's ticket, it remains to be seen whether it can be fixed correctly. Additionally when I originally posited the question in #pypa-dev, the response given was that it was likely intentional that it only handle ASCII paths.

Final addendum: if the zip is no longer a "safe" choice (across tools, O/Ses, locales, whatever) then the download page probably ought to stop linking to the zipball.

comment:3 by Tim Graham, 9 years ago

PR to update the download page.

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