On Tue, Oct 16, 2012 at 11:10 AM, Legault, Alain <
[email protected]> wrote:
> Hello François,
>
> Thanks for the pointer. The explicit import solved one problem.
>
> Unfortunately, Py2exe had more surprises in store for us.
>
> Py2exe will compile the following source
>
> from sklearn.utils import weight_vector
> from sklearn.decomposition import PCA
> Pass
>
> But the exe will crash with
>
> Traceback (most recent call last):
> File "exe.py", line 3, in <module>
> File "zipextimporter.pyo", line 82, in load_module
> File "sklearn\decomposition\__init__.pyo", line 8, in <module>
> File "zipextimporter.pyo", line 82, in load_module
> File "sklearn\decomposition\pca.pyo", line 302, in <module>
> File "sklearn\decomposition\pca.pyo", line 304, in ProbabilisticPCA
> TypeError: unsupported operand type(s) for +=: 'NoneType' and 'NoneType'
>
> So the offendinbg lines (to py2exe) in PCA are
>
>
> 302 class ProbabilisticPCA(PCA):
> 303 """Additional layer on top of PCA that adds a probabilistic
> evaluation"""
> 304 __doc__ += PCA.__doc__
>
> Seems py2exe can't stomach line 304.
>
> Commenting 304 out (innocuous enough I think) makes the thing fly :-)))
>
This could be because you used:
"optimize": 1
in your setup.py. That may remove the docstrings.
>
> Thanks again for the pointer
>
>
>
> Dr Alain Legault
>
> scientifique sénior | senior scientist
>
> Groupe Optimisation des Procédés Industriels | Industrial Systems
> Optimization Group
>
> CanmetÉNERGIE | CanmetENERGY
> Ressources naturelles Canada | Natural Resources Canada
> 1615 Lionel-Boulet, C.P. 4800, Varennes, Qc J3X 1S6
>
>
>
> [email protected]
> Téléphone | Telephone +1-450-652-7031
>
> Télécopieur | Facsimile +1-450-652-5918
>
>
>
> Gouvernement du Canada | Government of Canada
>
> www.canmetenergie.rncan.gc.ca | www.canmetenergy.nrcan.gc.ca
>
>
> -----Original Message-----
> From: François Deheeger [mailto:[email protected]]
> Sent: Thursday, October 11, 2012 7:51 AM
> To: [email protected]
> Subject: Re: [Scikit-learn-general] Sklearn and PY2exe
>
> Hello,
>
> i recently have this kind of problem using pyinstaller (another packaging
> tool.. but things should not be so different). They call this hidden
> imports problem and I fixed this by adding explicit imports in the main
> file :
>
> # pyinstaller hidden imports
> from sklearn.utils import weight_vector
> from sklearn.decomposition import PCA, FastICA from sklearn.pls import
> PLSRegression
>
> With those lines, i succeeded in making a stand-alone app that uses
> sklearn (and more).
>
>
> Many modules have some hidden imports problems (hidden means 'my packaging
> tool do not see it'). To solve this in pyinstaller they use 'hook files'
> for standard modules. One day i may try to make one... I think that sklearn
> deserves to get one !
>
> Hope it helps.
>
>
>
> 2012/10/11 Olivier Grisel <[email protected]>:
> > Apparently this is a known issue of py2exe with cython modules:
> >
> > http://www.digipedia.pl/usenet/thread/15906/9309/
> >
> > Try adding the missing cython modules explicitly in your includes to
> > see if make it possible to workaround the py2exe dependency detection
> > limitations.
> >
> > --
> > Olivier
> >
> > ----------------------------------------------------------------------
> > -------- Don't let slow site performance ruin your business. Deploy
> > New Relic APM Deploy New Relic app performance management and know
> > exactly what is happening inside your Ruby, Python, PHP, Java, and
> > .NET app Try New Relic at no cost today and get our sweet Data Nerd
> > shirt too!
> > http://p.sf.net/sfu/newrelic-dev2dev
> > _______________________________________________
> > Scikit-learn-general mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
>
> --
>
> François Deheeger
>
>
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly what is
> happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic
> at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general