Unable to use pyexcel-xls with pyinstaller . python executable not working . python version 3.4.4

Issue

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, but execution of the script fails and following error is thrown.

Traceback (most recent call last):
  File "site-packages\pyexcel_io\manager.py", line 160, in create_reader
  File "site-packages\pyexcel_io\manager.py", line 222, in _get_a_handler
pyexcel_io.manager.NoSupportingPluginFound: No suitable library found for xls

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "script.py", line 8, in <module>
  File "site-packages\pyexcel_xls\__init__.py", line 29, in get_data
  File "site-packages\pyexcel_io\io.py", line 36, in get_data
  File "site-packages\pyexcel_io\io.py", line 126, in load_data
  File "site-packages\pyexcel_io\manager.py", line 171, in create_reader
pyexcel_io.manager.SupportingPluginAvailableButNotInstalled: Please install pyexcel-xls
Failed to execute script script

The respective python script is :

from pyexcel_xls import save_data , get_data
data = get_data("registered-market-makers-by-security.xls")
save_data("file_to_consume.xls", data)

How can I avoid this error and create a functional .exe file?

My client has windows environment.

I have also tried py2exe but it has some conflicts with windows dll’s in my machine.

Solution

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.

Answered By – Stephen Rauch

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published