Brent hit it right on!
I had optimisation level set to 2 which does remove the docstrings from the exe.
Reverting to level 1 (i.e. python -O (only optimize the bytecode) ) fixes the
docstring problem.
Good work! :-) and many thanks.
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]<mailto:[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<http://www.canmetenergie.rncan.gc.ca/> |
www.canmetenergy.nrcan.gc.ca<http://www.canmetenergy.nrcan.gc.ca/>
________________________________
From: Brent Pedersen [mailto:[email protected]]
Sent: Tuesday, October 16, 2012 2:51 PM
To: [email protected]
Subject: Re: [Scikit-learn-general] Sklearn and PY2exe
On Tue, Oct 16, 2012 at 11:10 AM, Legault, Alain
<[email protected]<mailto:[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]<mailto:[email protected]>
Téléphone | Telephone +1-450-652-7031<tel:%2B1-450-652-7031>
Télécopieur | Facsimile +1-450-652-5918<tel:%2B1-450-652-5918>
Gouvernement du Canada | Government of Canada
www.canmetenergie.rncan.gc.ca<http://www.canmetenergie.rncan.gc.ca> |
www.canmetenergy.nrcan.gc.ca<http://www.canmetenergy.nrcan.gc.ca>
-----Original Message-----
From: François Deheeger
[mailto:[email protected]<mailto:[email protected]>]
Sent: Thursday, October 11, 2012 7:51 AM
To:
[email protected]<mailto:[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]<mailto:[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]<mailto:[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]<mailto:[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]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general