takluyver / pynsist

Build Windows installers for Python applications
https://pynsist.readthedocs.io/
Other
883 stars 119 forks source link

How does the importing packages works in Pynisist? and a suggestion... #194

Closed wxguy closed 4 years ago

wxguy commented 4 years ago

It might sound silly. But having trouble since last few hours to figure out how to properly include modules in to pkg directory. There are certain modules which have different package name and module import names such as Pillow for PIL and Jinja2 as jinja2. The install location of those modules are generally the name of modules (PIL etc). When I executed pip freeze command it listed Pillow as module with version naming. Thereofore, it is little confusing to figure out which name should I supply so as to make the pynsist correctly copy the module directory in to pkg directory.

Ok. Then comes the second query. There are certain modules which has same name for modules and package such as mpl_toolkits and pyshape etc. However, they are not getting copied what so ever from the host system even I specify correct module name in installer.cfg file. Both the cases are contradicting and I had to spend many hours to figure those problematic modules. May be you should specify this info in your documentation somewhere.

In those cases there has to be some flexibility in configuration file (something like include_pkg_dirs=[]) to specify direct copying of module directories to pkg directory. Also, you may think of adding another feature such as exclude option in the config file as my application is a cross platform and include both Linux and Windows binaries which I don't want to put across the sides while compiling. Since my application uses many big modules, it takes close to 10 min to figure out what goes wrong with single module in the installer. Other installers offers such solution. I am not saying that you have to follow them by ditto. But may be need to consider those options as pynsist is the only installer worked for me in console mode properly.

takluyver commented 4 years ago

Which names to use: if you're listing pypi_wheels=, you need the PyPI names - the same ones pip works with. This is the recommended way where possible. If you're listing packages=, you need the names that you import. Docs on the include section.

Problems with specific packages: I know mpl_toolkits is a namespace package - one made of several pieces which can be installed separately. Specifying these in packages won't work, but hopefully you can specify the parts that you want with pypi_wheels. I don't know about pyshape, I haven't come across that before.

Including entire package directories: anything in a pynsist_pkgs folder next to the config file will be copied in to your application's packages. See building on other platforms in the FAQ.

Excluding files: There is an exclude option in the config file. See the include section of the docs. :-)

wxguy commented 4 years ago

Thanks for the clarification. May be the confusion came due to deprivation of sleep... Time to sleep...