vendredi 24 août 2018

Pattern module issue when using Pyinstaller to build an executable

I'm building an executable using PyInstaller (3.3.1), which relies on the pattern.en module (3.6). I'm able to get the executable, but I have the following error messages (depending if I import them as import pattern or from pattern import singularize, lemma, etc.) when I run it:

ImportError: No module named pattern.en

ImportError: cannot import name 'singularize'

module pattern.en has no attribute singularize

I tried the following option (ImportError with PyInstaller (using module pattern.de)):

--hidden-import=pattern.text

but I still get the same error message. I copied all the files (and folders) from ~\Pattern-3.6-py3.6.egg\pattern to the pattern folder created by Pyinstaller, then the program/executable works as expected.

The problem is that I'm using the option of the pyinstaller command --onedir --debug right now, but I'd like to create only one file at the end (i.e., --onefile --windowed). If I do so, I will no longer be able to copy the content of the pattern module.

I tried to add all the paths I could as options (for example, -p C:\Users\Anthony\Anaconda3\lib\site-packages\pattern-3.6-py3.6.egg) as well as all the hidden imports (e.g., --hidden-import=pattern), but it still doesn't work (except by copying the pattern content).

Any suggestions are more than welcome!

Aucun commentaire:

Enregistrer un commentaire