[Distutils] Help with easy_install

Phillip J. Eby pje at telecommunity.com
Mon Dec 1 18:47:54 CET 2008

At 09:24 AM 12/1/2008 +0000, Martin Manns wrote:
>Phillip J. Eby <pje <at> telecommunity.com> wrote:
> > From reading your setup script, I don't understand why your package
> > needs a .pth file of its own, let alone why it's writing it directly
> > in the setup script.  I would expect it to work correctly if you
> > simply delete that portion of the setup script.  In fact, it works
> > for me that way.
>Without the .pth file, the libraries in the folder pyspread are not found.
>If I leave it out, the program fails to start (after installation finished

You'll need to be more specific about what "fails to start" 
means.  What specifically happens?  What is the traceback?

> > > One other thing you need to change if you want easy_install to handle
> > > dependencies:
> > >
> > >       requires=['numpy (>=1.1)', 'wx (>=2.7)'],
> > Either change this line (or add another) saying:
> >
> >     install_requires=["numpy>=1.1", "wx>=2.7"],
>This does not work at all for me. I do have all dependencies met (I am
>installing everything else via apt) but easy_install does not 
>recognize it and
>throws a DistributionNotFound: wx>=2.7 *after* installation.

Ah.  Well, in that case, I guess you can leave wx out of it.  I 
forgot that wx doesn't have egg support yet.

> > And of course, delete the entire block below; as far as I can tell,
> > it's not needed for distutils or setuptools.
> >
> > >import distutils.sysconfig
> > >try:
> > >     pthfile = open(get_python_lib() + "/pyspread.pth", 'w')
> > >     pthfile.write("pyspread")
> > >     pthfile.close()
> > >except IOError:
> > >     print 'Creation of ' + distutils.sysconfig.get_python_lib() + '
> > > pyspread.pth
> > >failed.'
>And how do I get the pyspread.pth file created?

You don't.  If your program isn't working without it, it probably 
means your program isn't doing its imports correctly.

Offhand, my guess is that you're using pyspread.pyspread as a main 
program, and also trying to import things from the pyspread 
package.  That won't work correctly, because Python puts the 
directory containing the __main__ script as the first entry on 
sys.path -- meaning that when you try to import from the pyspread 
*package*, you instead wind up importing from the pyspread 
*script*.  But let's see your traceback to find out what's really going on.

More information about the Distutils-SIG mailing list