user13491496
user13491496

Reputation:

Pyinstaller - Python exe when run shows error "Failed to execute script pyi_rth_nltk"

I have developed a simple software in python with GUI. I'm actually working on Natural Language Processing and I've just put the whole NLP process in a GUI.

I tried to convert the whole project to a exe file in python using Pyinstaller. I successfully converted it to an exe file but when I run it , it shows an error message something like this This is the image of my error

Upvotes: 1

Views: 1557

Answers (3)

Mohammed Hashim
Mohammed Hashim

Reputation: 31

Few days back, I had the same problem while compressing to EXE. This Problem generally occurs when PyInstaller failes to find Libraries and Modules to import to the directory. But I overcame this problem and the wise solution yet tedious method to do is mentioned below,

  1. Convert Python Scripts to EXE with console = True in the .spec file or to be simple, do not add --noconsole argument while converting using System Argmuents method.(execute GUI with CMD)

  2. After successfully building the file, go to respective directory (dist folder) and open command prompt

  3. Run the Exe file using Command Prompt.

  4. Find the error message and rectify it correspondingly. For example, consider the following Error Message, vcomp140.dll is missing from \\sklearn\\libs directory.

  5. At the end of this Error Message, you'll find Failed to load dynlib/dll , Therefore, find the file or program which is missing. Say, Here we've .libs\\vcomp140.dll

  6. Find vcomp140.dll using window search bar in your C Drive.

  7. Copy the specific file and paste in the directory(under "dist" folder) where the file is missing. Here, the directory is dist\\PyScriptToEXE\\sklearn\\.libs

MatplotlibDeprecationWarning:
The MATPLOTLIBDATA environment variable was deprecated in Matplotlib 3.1 and will be removed in 3.3.
  exec(bytecode, module.__dict__)
Traceback (most recent call last):
...
...
...
py3.7.egg\PyInstaller\loader\pyiboot01_bootstrap.py", line 169, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll 'C:\\Users\\MOHAMM~1\\AppData\\Local\\Temp\\_MEI38242\\sklearn\\.libs\\vcomp140.dll'. Most probably this dynlib/dll was not found when the application was frozen.
[13968] Failed to execute script try
  1. Follow the steps again using CMD to eliminate each error.

Upvotes: 0

user13491496
user13491496

Reputation:

I have already solved it but by using another way of converting py to exe which is the cx_Freeze.

Upvotes: 1

dkrolls
dkrolls

Reputation: 1

I had the same issue earlier today and finally got it to work using the following software versions:

Python 3.6.8, nltk 3.5 and a dev version of pyinstaller:

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

Additionally, I used scikit-learn version 0.21.1.

Upvotes: 0

Related Questions