No module named 'packaging.specifiers' (resolved)

34 views
Skip to first unread message

gpraceman

unread,
Jun 19, 2019, 8:02:05 AM6/19/19
to PyInstaller
Man, what a pain in the butt it has been to get PyInstaller to work with Python 3.7 on Windows 10, but I finally got my Gtk3+ app to package and run.

First, I ran into a big issue with DLL's not being found.  See Issue #4125.  To resolve that issue, I had to download and install the dev version of PyInstaller.  Then I implemented the proposed changes from Pull #4240, including htgoebel's proposed edits.  Now, when I package my app, it finds all of the needed DLL's.

However, when running the packaged app, I got a "No module named 'packaging.specifiers'" error.  I had to edit the site-packages/pkg_resources/__init__.py file.  I replaced the __import__() statements, lines 89-92, with regular import statements.  Repackaged the app and now it runs with no errors!  That is a huge relief. 

Hopefully, this information will help someone.  At a minimum, if should serve to confirm that the changes in Pull #4240, along with the proposed edits, do work and should be implemented.

Eric Fahlgren

unread,
Jun 19, 2019, 12:11:06 PM6/19/19
to pyins...@googlegroups.com
Since you mention Py 3.7 specifically, I'm just curious as to how much of this you feel relates to Py 3.7?  When I moved from 3.6.3 to 3.7.1 last October, it was pretty much painless, but we're using wxPython for gui and it has been very stable in this regard for years.  Most of my PyInstaller drama comes from SciPy updates, which always seem to add or restructure some DLL import somewhere.

--
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...@googlegroups.com.
To post to this group, send email to pyins...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyinstaller.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/84b4310f-436b-4e55-be52-577cf132a94d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gpraceman

unread,
Jun 19, 2019, 5:38:28 PM6/19/19
to PyInstaller
Eric,

I had been using PyInstaller to package up my Gtk3 app for years, on Python 3.4.  My problem came about when I needed to upgrade Gtk3 to a newer version.  Only way it seems to install Gtk3 on Windows, above Python 3.4, is using MSYS2.  MSYS2 only installs the latest version of Python (3.7.3).   It took some doing, but I was finally able to get Gtk3 working on Python 3.7.  However, PyInstaller would not package up the app.   There was no moving backwards to Python 3.6, with MSYS2, to give that a try.  In a web search, others reported issues packaging with 3.7, but were successful if reverting to 3.6.  As, I need to get my app delivered soon, I chose to dive into the PyInstaller code and try to fix the packaging issues with 3.7.

Also, on my macOS machine, same app would not package on Python 3.7.3.  I got some "Security-Alert: try to store file outside of dist-directory" error.  Switched to Python 3.6.8 (thanks to pyenv) and PyInstaller was able to package up the app.

Not sure why the version of Python makes much of a difference with PyInstaller, but it sure seems to.

Randy

On Wednesday, June 19, 2019 at 10:11:06 AM UTC-6, Eric Fahlgren wrote:
Since you mention Py 3.7 specifically, I'm just curious as to how much of this you feel relates to Py 3.7?  When I moved from 3.6.3 to 3.7.1 last October, it was pretty much painless, but we're using wxPython for gui and it has been very stable in this regard for years.  Most of my PyInstaller drama comes from SciPy updates, which always seem to add or restructure some DLL import somewhere.

On Wed, Jun 19, 2019 at 5:02 AM gpraceman <gpra...@gmail.com> wrote:
Man, what a pain in the butt it has been to get PyInstaller to work with Python 3.7 on Windows 10, but I finally got my Gtk3+ app to package and run.

First, I ran into a big issue with DLL's not being found.  See Issue #4125.  To resolve that issue, I had to download and install the dev version of PyInstaller.  Then I implemented the proposed changes from Pull #4240, including htgoebel's proposed edits.  Now, when I package my app, it finds all of the needed DLL's.

However, when running the packaged app, I got a "No module named 'packaging.specifiers'" error.  I had to edit the site-packages/pkg_resources/__init__.py file.  I replaced the __import__() statements, lines 89-92, with regular import statements.  Repackaged the app and now it runs with no errors!  That is a huge relief. 

Hopefully, this information will help someone.  At a minimum, if should serve to confirm that the changes in Pull #4240, along with the proposed edits, do work and should be implemented.

--
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 pyins...@googlegroups.com.

Eric Fahlgren

unread,
Jun 30, 2019, 5:23:26 AM6/30/19
to pyins...@googlegroups.com
A recent post on py-dev (first link below) makes me think there is a way to fix this issue without changing PyInstaller, albeit with a bit of ctypes coding needed, at least until 3.8 is available.  (I'm sensitive to this as I know our application will need to adapt, so I thought I'd toss this out here, since it seems related.)

 
From the 3.8 porting notes:

"DLL dependencies for extension modules and DLLs loaded with ctypes on Windows are now resolved more securely. Only the system paths, the directory containing the DLL or PYD file, and directories added with add_dll_directory() are searched for load-time dependencies. Specifically, PATH and the current working directory are no longer used, and modifications to these will no longer have any effect on normal DLL resolution. If your application relies on these mechanisms, you should check for add_dll_directory() and if it exists, use it to add your DLLs directory while loading your library. Note that Windows 7 users will need to ensure that Windows Update KB2533625 has been installed (this is also verified by the installer). (See bpo-36085.) " 

On Thu, Jun 20, 2019 at 11:54 AM Eric Fahlgren <ericfa...@gmail.com> wrote:
Randy,

Thanks for the background, always useful to know other's problems in case there's any overlap.

Eric

To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.

To post to this group, send email to pyins...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyinstaller.

Eric Fahlgren

unread,
Jun 30, 2019, 5:26:30 AM6/30/19
to pyins...@googlegroups.com
Randy,

Thanks for the background, always useful to know other's problems in case there's any overlap.

Eric

On Wed, Jun 19, 2019 at 2:38 PM gpraceman <gpra...@gmail.com> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.

To post to this group, send email to pyins...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyinstaller.
Reply all
Reply to author
Forward
0 new messages