Error installing Python building script

I have the following case:

  • Desktop Application with Python + PySide
  • Want to use the PYD file (mycore.pyd) in my application
  • There is one dependency in the fill module in mycore.pyx
    • This fill module is already installed in the system
  • I create Setup.py and convert the PYX file to the PYD file that I use in the application

What I got:

  • Once I launched the application in PyCharm => everything is fine
  • when I create an application with the PyInstaller approach and start the application from cmd => I will catch the error "There is no named module" Filling (requests, etc.) "

Example 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 tips would be great!

UPDATE

Also tried the 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 ) 
+4
source share
3 answers

Ask PyInstaller to enable the required module during the build process. It seems the easiest way to do this is --hidden-import :

--hidden-import=modulename
Name the imported Python module that does not appear in your code. The module will be included as if it were specified in the import statement. This parameter can be set several times.

Thus, add the following argument when creating the application:

--hidden-import=Padding


EDIT:

Try importing all the necessary modules (which cause the error) in a separate *.py file, and not in the *.pyx \ *.pyd . This is an ugly workaround, but it can solve the problem nonetheless.

Consider using the __init__.py file for this scenario.

+3
source

Here is the setup.py file ( https://github.com/robintiwari/django-me/blob/master/setup.py ) that I recently created and works with a similar problem, and I agree with @Sanju to use setuptools.find_packages (). This fixed the problem for me.

+1
source

I assume the problem is that PyInstaller does not see packages imported by cython code, so it does not include it with package applications.

There should be a way to tell PyInstaller to enable the Padding package.

I can’t say how to do this - I have never used it, but this is how you deal with it with py2exe and py2app.

+1
source

All Articles