ianb / pip (http://pip.openplans.org/)

Pip Installs Packages. For Python.

Clone this repository (size: 659.8 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/ianb/pip/
follow

#56 pip fails to install reportlab

Reported by Anonymous, created 7 weeks ago, last edited unknown.

Pip fails to install reportlab. easy_install works. Pip output below...

$ pip install reportlab
Downloading/unpacking reportlab
  Downloading reportlab-2.4.tar.gz (1.9Mb): 1.9Mb downloaded
  Storing download in cache at /tmp/pip_cache/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fr%2Freportlab%2Freportlab-2.4.tar.gz
  Running setup.py egg_info for package reportlab
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
    IOError: [Errno 2] No such file or directory: '/Users/rhudson/.virtualenvs/pisatest/build/reportlab/setup.py'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

IOError: [Errno 2] No such file or directory: '/Users/rhudson/.virtualenvs/pisatest/build/reportlab/setup.py'

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /tmp/pip-log.txt

Status: wontfix Responsible: nobody Type: bug
Milestone: none Component: none Version: none

Attachments

No attachments added for this issue yet.

Comments and changes

#1

Carl Meyer / carljm

This is related to #2 - its about installing packages whose setup.py is not at the root level. Not marking as a dupe, though, since #2 is about VCS URLs and this is about tarballs.

I'm curious what algorithm easy_install uses here; does it just walk the tree breadth-first until it finds a setup.py? Probably; guess I could check the code and see...


#2

legalsense

easy_install just does a glob:

        # Find the setup.py file
        setup_script = os.path.join(setup_base, 'setup.py')

        if not os.path.exists(setup_script):
            setups = glob(os.path.join(setup_base, '*', 'setup.py'))
            if not setups:
                raise DistutilsError(
                    "Couldn't find a setup script in %s" % os.path.abspath(dist_filename)
                )
            if len(setups)>1:
                raise DistutilsError(
                    "Multiple setup scripts in %s" % os.path.abspath(dist_filename)
                )
            setup_script = setups[0]

I might fork and implement, will provide patch then


#3

vanschelven

(I am also 'legalsense')

I'm not fully able to solve this one alone. Started using pip today, maybe developing is a bridge too far. Anyway, partial progress may be interesting for others.

I forked http://bitbucket.org/vanschelven/pip/ and brought in the above mentioned code from easy_install. However, reportlab still fails to install:

Traceback (most recent call last):
  File "<string>", line 14, in <module>
  File "/home/klaas/dev/envs/pip/build/reportlab/ReportLab_2_4/setup.py", line 460, in <module>
    main()
  File "/home/klaas/dev/envs/pip/build/reportlab/ReportLab_2_4/setup.py", line 422, in main
    version=get_version(),
  File "/home/klaas/dev/envs/pip/build/reportlab/ReportLab_2_4/setup.py", line 68, in get_version
    raise ValueError('Cannot determine ReportLab Version')
ValueError: Cannot determine ReportLab Version

It appears that reportlab also tries to read it's own sourcecode to determine the version, and that my patch does not start reportlab's setup.py in the correct cwd (or something similar). Relevant setup.py code:

 38 def get_version():
 39     if daily: return 'daily'
 40     #determine Version
 41     HERE = pkgDir
 42     if os.getcwd()!=HERE:
 43         if __name__=='__main__':
 44             HERE=os.path.dirname(sys.argv[0])
 45         else:
 46             HERE=os.path.dirname(__file__)
 47
 48     #first try source
 49     FN = pjoin(HERE,'src','reportlab','__init__')
 50     try:
 51         for l in open(pjoin(FN+'.py'),'r').readlines():
 52             if l.startswith('Version'):
 53                 exec l.strip()
 54                 return Version
 55     except:
 56         pass
 57
 58     #don't have source, try import
 59     import imp
 60     for desc in ('.pyc', 'rb', 2), ('.pyo', 'rb', 2):
 61         try:
 62             fn = FN+desc[0]
 63             f = open(fn,desc[1])
 64             m = imp.load_module('reportlab',f,fn,desc)
 65             return m.Version
 66         except:
 67             pass
 68     raise ValueError('Cannot determine ReportLab Version')

Any ideas? I'm going with easy_install for now...


#4

vanschelven

Ok, I got my fork to install reportab. Feel free to check it out.

I wouldn't dare to call it a patch yet though, 'cause the tests won't run (at all) with me. I'm getting

IOError: [Errno 2] No such file or directory: './test_basic.txt'

Also, my understanding of the (pip) code is not sufficient to be confident that I'm not breaking anything. I've replaced a number of references to self.source_dir to os.path.basename(self.setup_py), which might have further reaching consequences than I can oversee.


#5

Carl Meyer / carljm

This one really needs a design decision as to whether pip should even support packages who don't put setup.py at the root of the distribution where it ought to be. I'm not convinced that it should: those packages should be fixed.


#6

Rich Leland / richleland

I agree with Carl on this one. Packages should be fixed to include setup.py in the root of the distro.


#8

Ian Bicking / ianb

→ Changed status from new to wontfix.

I agree; I'd at least like to know that the reportlab people have been informed of this problem, and get a response from them, before trying to work around it in pip.

Update or reopen this ticket if this is not for some reason feasible on their end.


#9

vanschelven

Just to make sure I understand the (reportlab's?) problem:

Reportlab's tar.gz as found on Pypi:

/
|--- PKG-INFO
|--- ReportLab_2_4
        |---- setup.py
        |---- src
        |---- ....

Correct would be: PKG-INFO inside that directory "ReportLab_2_4"?


#10

vanschelven

Also: http://www.reportlab.com/ftp/ReportLab_2_4.tar.gz (Reportlab's own download) does not contain any PKG-INFO file.

Any idea how that could have ended up there?


#11 Anonymous

written 2 weeks ago, last edited unknown.

Discussion thread in the reportlab mailing list starts here: http://two.pairlist.net/pipermail/reportlab-users/2010-March/009346.html

I agree that the reportlab tarball on PyPI is broken. A small (but tedious to produce) MANIFEST.in would enable them to produce correct tarballs using the standard mechanism of 'python setup.py sdist', which is the solution I suggested on the list.


#12

Marius Gedminas / mgedmin

(Sorry, didn't notice the login form in the corner of the page. This was me writing comment #11.)


#13

Ian Bicking / ianb

And just to note, if a package has a single directory in it, and a setup.py is in that single directory, everything will work (this is how most packages work). Anything deeper, or if there isn't just one top-level directory, and things start to break.


Add comment / attachment

Show/hide preview

Verification: Please write the text from the image in the box (letters only)

captcha

Is that you, Humanoid? Is this me?