Skip to content Skip to sidebar Skip to footer

Unable To Use Pyexcel-xls With Pyinstaller . Python Executable Not Working . Python Version 3.4.4

The program works when run using: Python filename.py but when I create its executable file using 'pyinstaller' pyinstaller -F filename.py the executable is successfully created,

Solution 1:

The Problem

pyexcel-io uses a method for including plug-ins that pyinstaller does not support. See this issue.

The Workaround

The work around for this issue has a couple of facets.

Change needed to pyexcel

I have submitted a Change Request which shows how to modify pyexcel to allow it to work with pyinstaller. Basically pyexcel-io needs to know how to find frozen modules.

If the pyexcel guys pick up the Change Request, then that will get you going. But if they don't, or you are in a hurry, then copying the changed file from the change request into your site package directory as pyexcel_io/__init__.py will get pyexcel working.

But, pyinstaller also needs to know what to include.

pyinstaller also needs to know to include the required module. So on the pyinstaller command line you will also need to do:

--hidden-import pyexcel_xls.xls

Update:

Change request with this fix has been merged into master branch of pyexcel.

Update #2:

Fix has been released to pypi.

Solution 2:

For me worked this duo:

(1) --hidden-import pyexcel_xlsx.xlsxr (i just wanted to read xls) in pyinstaller command

and (important!):

(2) in main file adding "import pyexcel_xlsx.xlsxr"

and similarly for 'ods'; for csv: '--hidden-import pyexcel_io.readers.csv_in_file' / 'import pyexcel_io'

Solution 3:

I experienced the same issue using py2exe in place of pyinstaller. After doing some research on my code and some googling I ended up in this thread and found out that the problem is similar and so is the solution. If this can be of any help for others, in order to generate executables with py2exe with the use of pyexcel libraries I added 'pyexcel_xls.xls' and 'pyexcel_xlsx.xlsx' in the includes section in the py2exe setup options. So:

setup(
    name='Hello'
    version='0.1'
    description='Hello program'
    author='Me'
    options={
            'compressed': 1'optimized': 1'includes': ['pyexcel_xls.xls', 'pyexcel_xlsx.xlsx' ...]
        }
    console=['hello.py']
)

Post a Comment for "Unable To Use Pyexcel-xls With Pyinstaller . Python Executable Not Working . Python Version 3.4.4"