Pyinstaller: ImportError: The 'packaging' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution. [Fix]

Created on 28 Aug 2016  路  2Comments  路  Source: pyinstaller/pyinstaller

I encountered the following error when trying to bundle a GUI software (Manjaro Linux):

ImportError: The 'packaging' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.

This issue is already mentioned somewhere: https://github.com/pyinstaller/pyinstaller/issues/1781

However, the fix reported there was not enough, used alone.

Hopefully a guy on SO had the solution http://stackoverflow.com/questions/34921474/pyinstaller-on-32-bit-linux-importerror-the-six-package-is-required.

I had to downgrade setuptools to 19.2, but I also had to import some modules in my code explicitly:

import packaging
import packaging.version
import packaging.specifiers
import packaging.requirements

I'm reporting this problem in case someone needs a fix.

Most helpful comment

Thank you for posting your solution, I believe it saved me a bunch of work!

Just wanted to let you know, and pitch in an alternative solution that worked for me. Instead of changing the code, I added "packaging" as a hidden import. That is, I used

pyinstaller --hidden-import=packaging --hidden-import=packaging --hidden-import=packaging.version --hidden-import=packaging.specifiers --hidden-import=packaging.requirements main.py

All 2 comments

Thank you for posting your solution, I believe it saved me a bunch of work!

Just wanted to let you know, and pitch in an alternative solution that worked for me. Instead of changing the code, I added "packaging" as a hidden import. That is, I used

pyinstaller --hidden-import=packaging --hidden-import=packaging --hidden-import=packaging.version --hidden-import=packaging.specifiers --hidden-import=packaging.requirements main.py

Fix for this in progress.

Was this page helpful?
0 / 5 - 0 ratings