Reputation: 2011
I am trying to create a standalone program using pyinstaller. In this process I am encountering the following error message:
`Traceback (most recent call last):
File "<string>", line 13, in <module>
File "/opt/local/anaconda/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "/home/russellb/pyFiles/dist/build/tt/out00-PYZ.pyz/sklearn.neighbors", line 6, in <module>
File "/opt/local/anaconda/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py", line 409, in load_module
module = imp.load_module(fullname, fp, filename, self._c_ext_tuple)
File "dist_metrics.pxd", line 48, in init sklearn.neighbors.ball_tree (sklearn/neighbors/ball_tree.c:34295)
File "/opt/local/anaconda/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py", line 409, in load_module
module = imp.load_module(fullname, fp, filename, self._c_ext_tuple)
File "dist_metrics.pyx", line 52, in init sklearn.neighbors.dist_metrics (sklearn/neighbors/dist_metrics.c:25494)
ImportError: No module named typedefs`
Any suggestions?
As a follow-up:
I've managed to import typedef and got rid of the above problem. Now I am encountering the following error message at the run-time.
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/opt/local/anaconda/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "/home/russellb/pyFiles/dist/build/tt/out00-PYZ.pyz/sklearn.linear_model", line 21, in <module>
File "/opt/local/anaconda/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py", line 409, in load_module
module = imp.load_module(fullname, fp, filename, self._c_ext_tuple)
File "weight_vector.pxd", line 10, in init sklearn.linear_model.sgd_fast (sklearn/linear_model/sgd_fast.c:9464)
ImportError: No module named weight_vector
However, I could not find any module named weight_vector in the sklearn directory hierarchy in that specified location.
Any insights and suggestions?
Many thanks,
Upvotes: 3
Views: 3899
Reputation: 7448
I used the tool auto-py-to-exe. It is a gui tool which calls the pyinstaller internally. In the advanced options I've added to --hidden-import all the missing modules. In the command line I saw all the modules as the parameters:
--hidden-import sklearn.neighbors.typedefs --hidden-import sklearn.neighbors.quad_tree --hidden-import sklearn.tree._utils
Upvotes: 2
Reputation: 1432
You can add --hidden-import=modulename to your pyinstaller script. It will import this module and bind.
Upvotes: 3