Reputation: 2205
I have next case:
What I got:
Example of setup.py file:
from distutils.core import setup
from Cython.Build import cythonize
extensions = ["mycore.pyx"]
setup(
name='mycore',
version='1.0',
ext_modules=cythonize(extensions),
#packages=['Padding'], - once tried => "error: package directory 'Padding' does not exist"
)
Any ideas or advises would be great!
UPDATE
Also tried variant with setup_tools
, also without success:
from Cython.Build import cythonize
from setuptools import setup, find_packages, Extension, Command
setup(name='mycore',
packages = find_packages(),
version=1.0,
include_package_data=True,
platforms=['all'],
ext_modules=[Extension("mycore", ['mycore.c'])],
#extra_require = {"Padding"} - also nothing
)
Upvotes: 4
Views: 1132
Reputation: 9614
Ask PyInstaller to include the required module during the build process. It seems that the easiest way to do so is with the --hidden-import
argument:
--hidden-import=modulename
Name an imported Python module that is not visible in your code. The module will be included as if it was named in animport
statement. This option can be given more than once.
Thus, please add the following argument when building the application:
--hidden-import=Padding
EDIT:
Try importing all required modules (that trigger an error) in a separate *.py
file, rather than in a *.pyx
\ *.pyd
file. It's an ugly workaround but might solve the issue nonetheless.
Consider using an __init__.py
file for this scenario.
Upvotes: 3
Reputation: 595
I'm guessing that the problem is that PyInstaller doesn't see packages imported by cython code, so it doesn't include it with the bundles applications.
There must be a way to tell PyInstaller to include the Padding package.
I can't tell you how -- never used it, but this is how you deal with it with py2exe and py2app.
Upvotes: 1
Reputation: 121
Here is a setup.py (https://github.com/robintiwari/django-me/blob/master/setup.py) file that i recently created that works and was having similar issue and I would agree with @Sanju to use setuptools.find_packages(). It fixed the issue for me.
Upvotes: 1