py2app DistUtilsPlatformError[Sec=Unclassified]

View: New views
13 Messages — Rating Filter:   Alert me  

py2app DistUtilsPlatformError[Sec=Unclassified]

by Mathew Oakes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm stumped on this:

When running my app that has built without errors...

> ...An unexpected error has occured during installation of the main
> script
>
> DistutilsPlatformError: invalid Python installation: unable to
> open /Full/Path/To/App.app/Contents/Resources/include/python2.6/pyconfig.h (No such file or directory)

but python in in the bundle at .../Resources/lib/ and it doesn't have a
pyconfig header

python is installed via ports at /opt/local/bin/python

Alias mode and py2exe versions work.

Help appreciated!

cheers
Mat


___________________________________________________________________________

    Australian Antarctic Division - Commonwealth of Australia
IMPORTANT: This transmission is intended for the addressee only. If you are not the
intended recipient, you are notified that use or dissemination of this communication is
strictly prohibited by Commonwealth law. If you have received this transmission in error,
please notify the sender immediately by e-mail or by telephoning +61 3 6232 3209 and
DELETE the message.
        Visit our web site at http://www.antarctica.gov.au/
___________________________________________________________________________
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Aahz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Sep 23, 2009, mathew oakes wrote:

>
> I'm stumped on this:
>
> When running my app that has built without errors...
>
> > ...An unexpected error has occured during installation of the main
> > script
> >
> > DistutilsPlatformError: invalid Python installation: unable to
> > open /Full/Path/To/App.app/Contents/Resources/include/python2.6/pyconfig.h (No such file or directory)
>
> but python in in the bundle at .../Resources/lib/ and it doesn't have a
> pyconfig header

Ayup, you need to copy it from python2.5 -- pretty annoying.
--
Aahz (aahz@...)           <*>         http://www.pythoncraft.com/

gfarber: Thank God, or the belief system of your choice.
pddb: Does human perversity count as a belief system?
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Christopher Barker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Aahz wrote:
> On Wed, Sep 23, 2009, mathew oakes wrote:

>>> DistutilsPlatformError: invalid Python installation: unable to
>>> open /Full/Path/To/App.app/Contents/Resources/include/python2.6/pyconfig.h (No such file or directory)
>> but python in in the bundle at .../Resources/lib/ and it doesn't have a
>> pyconfig header
>
> Ayup, you need to copy it from python2.5 -- pretty annoying.

Indeed. Does anyone know what pyconfig.h is used for? Is it a setuptools
thing? py2app was written before setuptools, and I've found most of what
I've had to do by hand was due to egg issues.

Here's my code for this:

def AddMacExtras(NAME):
     # post processing:
     print "Adding extra stuff"

     if "-A"in sys.argv:
         print "Building an Alias -- not copying everything"
     else:
         ## ugly hard coding of paths!
         print "adding the pyconfig header"
 
shutil.copy("/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyconfig.h",
 
"dist/%s.app/Contents/Resources/include/python2.5/pyconfig.h"%NAME)



HTH,

-Chris





--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@...
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Aahz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Sep 23, 2009, Christopher Barker wrote:

> Aahz wrote:
>> On Wed, Sep 23, 2009, mathew oakes wrote:
>
>>>> DistutilsPlatformError: invalid Python installation: unable to
>>>> open /Full/Path/To/App.app/Contents/Resources/include/python2.6/pyconfig.h (No such file or directory)
>>> but python in in the bundle at .../Resources/lib/ and it doesn't have a
>>> pyconfig header
>>
>> Ayup, you need to copy it from python2.5 -- pretty annoying.
>
> Indeed. Does anyone know what pyconfig.h is used for? Is it a setuptools  
> thing? py2app was written before setuptools, and I've found most of what  
> I've had to do by hand was due to egg issues.

It's a setuptools thing.

> shutil.copy("/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyconfig.h",
> "dist/%s.app/Contents/Resources/include/python2.5/pyconfig.h"%NAME)

My solution is to just copy it once to the installed Python 2.6.
--
Aahz (aahz@...)           <*>         http://www.pythoncraft.com/

gfarber: Thank God, or the belief system of your choice.
pddb: Does human perversity count as a belief system?
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Ned Deily :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In article <20090923163646.GA26464@...>,
 Aahz <aahz@...> wrote:

> On Wed, Sep 23, 2009, Christopher Barker wrote:
> > Aahz wrote:
> >> On Wed, Sep 23, 2009, mathew oakes wrote:
> >
> >>>> DistutilsPlatformError: invalid Python installation: unable to
> >>>> open
> >>>> /Full/Path/To/App.app/Contents/Resources/include/python2.6/pyconfig.h
> >>>> (No such file or directory)
> >>> but python in in the bundle at .../Resources/lib/ and it doesn't have a
> >>> pyconfig header
> >>
> >> Ayup, you need to copy it from python2.5 -- pretty annoying.
> >
> > Indeed. Does anyone know what pyconfig.h is used for? Is it a setuptools  
> > thing? py2app was written before setuptools, and I've found most of what  
> > I've had to do by hand was due to egg issues.
>
> It's a setuptools thing.

I believe pyconfig.h is created by the compiler build ./configure script
to capture the relevant platform-dependent build configuration for that
python instance and is used by distutils build_ext so that package C
extensions can be correctly built.

> > shutil.copy("/Library/Frameworks/Python.framework/Versions/2.5/include/pytho
> > n2.5/pyconfig.h",
> > "dist/%s.app/Contents/Resources/include/python2.5/pyconfig.h"%NAME)
>
> My solution is to just copy it once to the installed Python 2.6.

I'm not a py2app user so I'm not sure I understand the problem you all
are seeing.  Is it that pyconfig.h isn't being installed in
/Library/Frameworks by a Python installer?

--
 Ned Deily,
 nad@...

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Aahz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Sep 23, 2009, Ned Deily wrote:

> In article <20090923163646.GA26464@...>,
>  Aahz <aahz@...> wrote:
>> On Wed, Sep 23, 2009, Christopher Barker wrote:
>> > Aahz wrote:
>> >> On Wed, Sep 23, 2009, mathew oakes wrote:
>> >
>> >>>> DistutilsPlatformError: invalid Python installation: unable to
>> >>>> open
>> >>>> /Full/Path/To/App.app/Contents/Resources/include/python2.6/pyconfig.h
>> >>>> (No such file or directory)
>> >>> but python in in the bundle at .../Resources/lib/ and it doesn't have a
>> >>> pyconfig header
>> >>
>> >> Ayup, you need to copy it from python2.5 -- pretty annoying.
>> >
>> > Indeed. Does anyone know what pyconfig.h is used for? Is it a setuptools  
>> > thing? py2app was written before setuptools, and I've found most of what  
>> > I've had to do by hand was due to egg issues.
>>
>> It's a setuptools thing.
>
> I believe pyconfig.h is created by the compiler build ./configure script
> to capture the relevant platform-dependent build configuration for that
> python instance and is used by distutils build_ext so that package C
> extensions can be correctly built.

It's not included in the .dmg for Python 2.6.
--
Aahz (aahz@...)           <*>         http://www.pythoncraft.com/

gfarber: Thank God, or the belief system of your choice.
pddb: Does human perversity count as a belief system?
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Ned Deily :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In article <20090924131338.GA21078@...>,
 Aahz <aahz@...> wrote:

> On Wed, Sep 23, 2009, Ned Deily wrote:
> > In article <20090923163646.GA26464@...>,
> >  Aahz <aahz@...> wrote:
> >> On Wed, Sep 23, 2009, Christopher Barker wrote:
> >> > Aahz wrote:
> >> >> On Wed, Sep 23, 2009, mathew oakes wrote:
> >> >>>> DistutilsPlatformError: invalid Python installation: unable to
> >> >>>> open
> >> >>>> /Full/Path/To/App.app/Contents/Resources/include/python2.6/pyconfig.h
> >> >>>> (No such file or directory)
> >> >>> but python in in the bundle at .../Resources/lib/ and it doesn't have
> >> >>> a
> >> >>> pyconfig header
> >> >> Ayup, you need to copy it from python2.5 -- pretty annoying.
> >> > Indeed. Does anyone know what pyconfig.h is used for? Is it a setuptools  
> >> > thing? py2app was written before setuptools, and I've found most of what
> >> > I've had to do by hand was due to egg issues.
> >> It's a setuptools thing.
> > I believe pyconfig.h is created by the compiler build ./configure script
> > to capture the relevant platform-dependent build configuration for that
> > python instance and is used by distutils build_ext so that package C
> > extensions can be correctly built.
> It's not included in the .dmg for Python 2.6.

Now I'm really confused :=)  I've just installed from the final
python.org 2.6, 2.6.1, and 2.6.2 install.dmgs and, for me, each one
installed what appears to be an appropriate file.  For example:

-rw-rw-r--  1 root  admin  30696 Apr 16 00:29
/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pycon
fig.h

Again, I'm no py2app expert but it looks like this might have been a
problem that Ronald fixed in py2app svn r65 (aka 0.4.0) back in 2008-01.  
>From various past postings, I gather py2app hasn't been formally
released in a long time and that the recommendation is to work from a
recent svn checkout (currently r80 and working towards 0.4.2).

--
 Ned Deily,
 nad@...

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Christopher Barker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ned Deily wrote:
>> It's not included in the .dmg for Python 2.6.
>
> Now I'm really confused :=)  I've just installed from the final
> python.org 2.6, 2.6.1, and 2.6.2 install.dmgs and, for me, each one
> installed what appears to be an appropriate file.  For example:

Well, I'm not using 2.6 yet, but with 2.5, my problem was that py2app
didn't copy pyconfig.h into the bundle, and that I gues setuptools was
looking for it.

The core problem is two-fold:

1) setuptools does all sorts of nifty stuff that really make no sense in
a bundled application, but I don't think there are any hooks in it to
disable or grcefuly fail  when bundled -- hmmm, maybe that's an idea for
a patch, though honestly, I'll never get around to it!

Also, I don't think a lot of this should be done at run time at all --
checking if the installed package version is correct, for instance, but
that's how a lot of folks use setuptools.

2) py2app is not setuptools aware at all. Unfortunately, it seems the
way to make it aware is kind of to punt: if there is an egg involved,
copy the whole darn thing in, 'cause there is no way to know what's
really needed!


> -rw-rw-r--  1 root  admin  30696 Apr 16 00:29
> /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pycon
> fig.h

By the way, I'm not using 2.6, but I have installed it, and I have
pyconfig.h also, so I'm not sure what the OP's issue was.

-Chris


--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@...
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Ned Deily :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In article <4ABBC381.4090500@...>,
 Christopher Barker <Chris.Barker@...> wrote:
> Ned Deily wrote:
> >> It's not included in the .dmg for Python 2.6.
> > Now I'm really confused :=)  I've just installed from the final
> > python.org 2.6, 2.6.1, and 2.6.2 install.dmgs and, for me, each one
> > installed what appears to be an appropriate file.  For example:
> Well, I'm not using 2.6 yet, but with 2.5, my problem was that py2app
> didn't copy pyconfig.h into the bundle, and that I gues setuptools was
> looking for it.

Just for the record, I don't think this particular issue has anything
directly to do with either setuptools or python2.6.  IIUC, pyconfig.h is
needed for any packages (packaged with standard *distutils*) that
include any C extension modules.  From a quick glance at the py2app
code, it looks like, prior to r65, py2app did not copy pyconfig.h at
all.  That wouldn't lead to problems until you tried to install a C
extension module.

--
 Ned Deily,
 nad@...

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Aahz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Sep 24, 2009, Ned Deily wrote:
>
> Just for the record, I don't think this particular issue has anything
> directly to do with either setuptools or python2.6.  IIUC, pyconfig.h is
> needed for any packages (packaged with standard *distutils*) that
> include any C extension modules.  From a quick glance at the py2app
> code, it looks like, prior to r65, py2app did not copy pyconfig.h at
> all.  That wouldn't lead to problems until you tried to install a C
> extension module.

Well, I don't have any time to track down what happened a few weeks ago,
but it was definitely the case that setuptools was crashing due to a
missing pyconfig.h, and the Python 2.6 installation I was using didn't
have one.
--
Aahz (aahz@...)           <*>         http://www.pythoncraft.com/

gfarber: Thank God, or the belief system of your choice.
pddb: Does human perversity count as a belief system?
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Christopher Barker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ned Deily wrote:
> Just for the record, I don't think this particular issue has anything
> directly to do with either setuptools or python2.6.  IIUC, pyconfig.h is
> needed for any packages (packaged with standard *distutils*) that
> include any C extension modules.

They should only need it when you build the packages though, not when
you run them.

>  From a quick glance at the py2app
> code, it looks like, prior to r65, py2app did not copy pyconfig.h at
> all.  That wouldn't lead to problems until you tried to install a C
> extension module.

I built many py2app bundles with C extensions without any pyconfig.h
file. I only had the issue when I packaged an app that made heavy (and I
think in appropriate) use of setuptools. Granted, it's a big and complex
app, so it could have been something else, but a simple C extension.

-Chris





--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@...
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Mathew Oakes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Working now!

I upgraded py2app, macholib, modulegraph and altgraph to svn versions
(although I found it hard to get the correct svn links...
http://mail.python.org/pipermail/pythonmac-sig/2008-July/020251.html)

pyconfig issues are then dealt with correctly.

Macports py2app is 0.36, and there is a py2app-devel at 0.42 which
requires svn access and I'm behind a firewall that blocks that.

Cairo appears to be only available via macports on mac, and I'm not
thorough enough to mix bits of different python distributions, so must
do everything through one.

I had a redundant import from wx.lib.cairo -- (was trying to display
generated svg files in a wx window. There were no simple recipes to be
found and couldn't justify the time involved when firefox or inkscape
can fulfil the function.)

Without that import, everything is fine.




On Fri, 2009-09-25 at 06:06 +1000, Ned Deily wrote:

> In article <4ABBC381.4090500@...>,
>  Christopher Barker <Chris.Barker@...> wrote:
> > Ned Deily wrote:
> > >> It's not included in the .dmg for Python 2.6.
> > > Now I'm really confused :=)  I've just installed from the final
> > > python.org 2.6, 2.6.1, and 2.6.2 install.dmgs and, for me, each one
> > > installed what appears to be an appropriate file.  For example:
> > Well, I'm not using 2.6 yet, but with 2.5, my problem was that py2app
> > didn't copy pyconfig.h into the bundle, and that I gues setuptools was
> > looking for it.
>
> Just for the record, I don't think this particular issue has anything
> directly to do with either setuptools or python2.6.  IIUC, pyconfig.h is
> needed for any packages (packaged with standard *distutils*) that
> include any C extension modules.  From a quick glance at the py2app
> code, it looks like, prior to r65, py2app did not copy pyconfig.h at
> all.  That wouldn't lead to problems until you tried to install a C
> extension module.
>
> --
>  Ned Deily,
>  nad@...
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@...
> http://mail.python.org/mailman/listinfo/pythonmac-sig


___________________________________________________________________________

    Australian Antarctic Division - Commonwealth of Australia
IMPORTANT: This transmission is intended for the addressee only. If you are not the
intended recipient, you are notified that use or dissemination of this communication is
strictly prohibited by Commonwealth law. If you have received this transmission in error,
please notify the sender immediately by e-mail or by telephoning +61 3 6232 3209 and
DELETE the message.
        Visit our web site at http://www.antarctica.gov.au/
___________________________________________________________________________
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: py2app DistUtilsPlatformError[Sec=Unclassified]

by Christopher Barker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

mathew oakes wrote:
> Cairo appears to be only available via macports on mac, and I'm not
> thorough enough to mix bits of different python distributions, so must
> do everything through one.

You should be able to use a macports Cairo lib with a non-macports
pyCairo, but if you've got something working...


> I had a redundant import from wx.lib.cairo -- (was trying to display
> generated svg files in a wx window. There were no simple recipes to be
> found

There is this:

http://code.google.com/p/wxpsvg/

It's really more of a proof of concept than production code, but it
might meet your needs. You need to get the code form svn:

http://code.google.com/p/wxpsvg/source/checkout

-Chris

(and no, I'm not the Chris that wrote that)



--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@...
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig