[PyInstaller] ModuleNotFoundError: No module named 'pkg_resources.py2_warn'
Hi, I am getting No module named 'pkg_resources.py2_warn' in pyinstaller when running the exe. Things that I have tried: 1. Updating the setuptools and pyinstaller (although I am already having the latest ones). 2. Used try except block with pass to ignore exceptions in pyi_rth_pkgres.py and pyimod03_importers.py by taking the reference from one of the post from this forum. *What I assume is that if I comment out the import statement of dialogflow_v2 in my script it works fine otherwise if I run the exe with dialogflow_v2 import statement, I get below error:* * File "site-packages\PyInstaller\loader\rthooks\pyi_rth_pkgres.py", line 13, in * * File "c:\users\ankit.bw.kumar\.conda\envs\envforpyqt\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module* * exec(bytecode, module.__dict__)* * File "pkg_resources\__init__.py", line 86, in * * ModuleNotFoundError: No module named 'pkg_resources.py2_warn'* * [17696] Failed to execute script pyi_rth_pkgres.* Thanks & Regards, Ankit Kumar -- You received this message because you are subscribed to the Google Groups "PyInstaller" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/5c61bbfd-fe0c-42fa-9901-0c5256808247%40googlegroups.com.
Re: [PyInstaller] ModuleNotFoundError: No module named 'pkg_resources.py2_warn'
Hi Brénainn, Thanks a lot, that helps! Thor. --- Dr. Thorsten Tepper García Astrophysicist www.thorsten.mx > On 21 Apr 2020, at 21:56, bwoodsend wrote: > > There are a couple of others. > > One is to put the following somewhere in your code: > import pkg_resources.py2_warn > Or to make it work as well with older setuptools versions: > try: > import pkg_resources.py2_warn > except ImportError: > pass > > A more satisfactory solution would be to use PyInstaller's hooks which tell > PyInstaller contain the hidden-import='pkg_resources.py2_warn' information. > The hook for pkg_resources has been updated on github but the changes haven't > been released yet. You could upgrade to the developer version on Github or > you could manually update that file in your own installation. > > Alternatively you can download that hook file and put it somewhere > PyInstaller can find it (usually next to your main script). > > Brénainn > > -- > You received this message because you are subscribed to the Google Groups > "PyInstaller" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pyinstaller+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pyinstaller/39fde230-b31e-4c7b-ad56-0509da6dbca5%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "PyInstaller" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/DEA5A996-821E-4299-9EE8-6F6782FF9C0D%40gmail.com.
[PyInstaller] ModuleNotFoundError: No module named 'pkg_resources.py2_warn'
Hi Guys, I just updated my python 3.6 version to a more recent one, and suddenly I get the error: ModuleNotFoundError: No module named 'pkg_resources.py2_warn' when running a Mac App. >From what I could find. apparently the problem is related to the version of setuptools (was 45 before, is 46 now). According to the discussion here: https://github.com/pypa/setuptools/issues/1963 A workaround is to compile the code with the flag: hidden-import='pkg_resources.py2_warn' And it actually works. However, I find this to be just an ugly solution and I was wondering whether there is another way to solve this problem? Cheers, Thor. -- You received this message because you are subscribed to the Google Groups "PyInstaller" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/b5a980ac-6053-4068-8d2a-1ec00d4cd896%40googlegroups.com.