pyinstaller help -- dealing with third party libraries

Viewed 978

currently trying to get a working executable of my main.py file which relies on a lot of nltk libraries. Using python 2.7.13 and most recent versions of nltk. Works well when I just run the script itself.

Here's the stack trace I'm receiving:

>>>Traceback (most recent call last): File "mainprogram.py", line 185,
>>>in <module> File "mainprogram.py", line 68,
>>>in explorer File "nltk\chunk\__init__.py", line 176,
>>>in ne_chunk File "nltk\data.py", line 839,
>>>in load ImportError: No module named named_entity

I've been reading through several posts about second layer imports potentially being the issue, but I'm not sure what I should be importing in this case. I don't think named_entity actually exists anywhere.

If anyone has any references or tips on how to move forward on debugging this would appreciate.

Thanks

Update: Here's my stacktrace with the verbose command.

[2017-10-06 18:25:51,687] ERROR in app: Exception on /trees [POST]
Traceback (most recent call last):
File "site-packages\flask\app.py", line 1982, in wsgi_app
File "site-packages\flask\app.py", line 1614, in full_dispatch_request
File "site-packages\flask\app.py", line 1517, in handle_user_exception
File "site-packages\flask\app.py", line 1612, in full_dispatch_request
File "site-packages\flask\app.py", line 1598, in dispatch_request
File "mainservice.py", line 30, in get_trees
File "mainprogram.py", line 68, in tree_search
File "site-packages\nltk\chunk\__init__.py", line 176, in ne_chunk
File "site-packages\nltk\data.py", line 839, in load
ImportError: No module named named_entity

The following ends up running into an error exactly at a line of code which looks like so:

branch = nltk.chunk.ne_chunk(item)

To give you more information I'm running pyinstaller on a service which really contains 2 files in such a directory

.
+-- Include
+-- Lib
+-- Scripts
+-- Src
|    +-- mainservice.py  << flask service
|    +-- mainprogram.py  << nltk logic

To build this I'm using the command in the Src directory: pyinstaller --hidden-import=flask --onefile mainservice.py mainprogram.py Ideally I'd want to use all of the functions I've built in mainservice. It seems like everything goes well until the nltk.chunk.ne_chunk(item) line.

0 Answers
Related