ImportError: The 'platformdirs' package is required

51 Views Asked by At

I hope you will be able to solve my pb! I wanted to use pyinstaller (6.5.0 - latest version) to compile my app.py code (under annaconda virtual environnement) but I get this error message below:

File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgres.py", line 158, in <module> File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgres.py", line 36, in _pyi_rthook File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "pkg_resources\__init__.py", line 74, in <module> File "pkg_resources\extern\__init__.py", line 52, in create_module File "pkg_resources\extern\__init__.py", line 44, in load_module ImportError: The 'platformdirs' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution. [21944] Failed to execute script 'pyi_rth_pkgres' due to unhandled exception!

I'm on windows 10. Thanks for help much appreciat!

I've tried to add platformdirs even pkg_resources using hidden-import but no success...

1

There are 1 best solutions below

0
Вячеслав Рябкин On

pyinstaller --onefile --paths=path\to\your\env\Lib\site-packages --hidden-import=platformdirs app.py This worked for me